本文整理汇总了Java中org.springframework.data.redis.core.HashOperations.get方法的典型用法代码示例。如果您正苦于以下问题:Java HashOperations.get方法的具体用法?Java HashOperations.get怎么用?Java HashOperations.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.data.redis.core.HashOperations
的用法示例。
在下文中一共展示了HashOperations.get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clearUserCounter
import org.springframework.data.redis.core.HashOperations; //导入方法依赖的package包/类
/**
* 消息用户计数
* @param userCountReq 会话信息
* @return 更新结果
* @since 1.0
*/
@PostMapping("/clearUserCounter")
public BaseModel<?> clearUserCounter(@RequestBody ClearUserCountReq userCountReq) {
HashOperations<String, String, String> hashOptions = redisTemplate.opsForHash();
if (userCountReq.getSessionType() == IMBaseDefine.SessionType.SESSION_TYPE_SINGLE) {
// Clear P2P msg Counter
final String userKey = RedisKeys.concat(RedisKeys.USER_UNREAD, userCountReq.getUserId());
hashOptions.delete(userKey, String.valueOf(userCountReq.getPeerId()));
} else if (userCountReq.getSessionType() == IMBaseDefine.SessionType.SESSION_TYPE_GROUP) {
// Clear Group msg Counter
final String groupSetKey = RedisKeys.concat(RedisKeys.GROUP_INFO, userCountReq.getPeerId(), RedisKeys.SETTING_INFO);
final String countValue = hashOptions.get(groupSetKey, RedisKeys.COUNT);
final String userUnreadKey = RedisKeys.concat(RedisKeys.GROUP_UNREAD, userCountReq.getUserId());
hashOptions.put(userUnreadKey, String.valueOf(userCountReq.getPeerId()), countValue);
} else {
logger.warn("参数不正: SessionType={}", userCountReq.getSessionType());
}
return null;
}
示例2: getToken
import org.springframework.data.redis.core.HashOperations; //导入方法依赖的package包/类
@Override
public String getToken(long userId) {
HashOperations<String, String, String> opsHash = redisTemplate.opsForHash();
String key = RedisKeys.concat(RedisKeys.USER_INFO, userId);
return opsHash.get(key, RedisKeys.USER_TOKEN);
}
示例3: queryPushShield
import org.springframework.data.redis.core.HashOperations; //导入方法依赖的package包/类
@GetMapping(path = "/login/queryPushShield")
public BaseModel<Integer> queryPushShield(@RequestParam("userId") long userId) {
String key = RedisKeys.concat(RedisKeys.USER_INFO, userId);
HashOperations<String, String, String> userMapOps = redisTemplate.opsForHash();
String shieldStatus = userMapOps.get(key, RedisKeys.USER_SHIELD);
BaseModel<Integer> res = new BaseModel<Integer>();
if (shieldStatus != null) {
res.setData(Integer.valueOf(shieldStatus));
}
return res;
}
示例4: getHash
import org.springframework.data.redis.core.HashOperations; //导入方法依赖的package包/类
@Override
public Object getHash(final String key, final String hashKey) {
final HashOperations<String, Object, Object> operation = redisTemplate.opsForHash();
final Object value = operation.get(getKey(key), hashKey);
return value;
}
示例5: hmGet
import org.springframework.data.redis.core.HashOperations; //导入方法依赖的package包/类
/**
* 哈希获取数据
* @param key
* @param hashKey
* @return
*/
public Object hmGet(String key, Object hashKey) {
HashOperations<String, Object, Object> hash = stringRedisTemplate.opsForHash();
return hash.get(key, hashKey);
}