本文整理了Java中org.springframework.data.redis.core.BoundHashOperations.put()
方法的一些代码示例,展示了BoundHashOperations.put()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BoundHashOperations.put()
方法的具体详情如下:
包路径:org.springframework.data.redis.core.BoundHashOperations
类名称:BoundHashOperations
方法名:put
[英]Set the value of a hash key at the bound key.
[中]在绑定键处设置哈希键的值。
代码示例来源:origin: spring-projects/spring-data-redis
@Override
public V put(K key, V value) {
V oldV = get(key);
hashOps.put(key, value);
return oldV;
}
代码示例来源:origin: org.springframework.data/spring-data-redis
@Override
public V put(K key, V value) {
V oldV = get(key);
hashOps.put(key, value);
return oldV;
}
代码示例来源:origin: org.springframework.cloud/spring-cloud-dataflow-registry
@Override
public void register(String key, URI uri) {
hashOps().put(key, uri.toString());
}
代码示例来源:origin: youngMen1/JAVA-
public void hset(String key, String field, String value) {
redisTemplate.boundHashOps(key).put(field, value);
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public V put(K key, V value) {
V oldV = get(key);
hashOps.put(key, value);
return oldV;
}
代码示例来源:origin: yzgod/tw-sso
/** 记录用户登录后对应userId和SessionId的Map关系 */
private static void addToMap(User user) {
String uId = user.getId().toString();
String sId = getRequest().getSession().getId();
Boolean hasKey = ou.hasKey(uId);
if (hasKey) {
String sids = ou.get(uId);
ou.put(uId, sids + sId);
} else {
ou.put(uId, sId);
}
}
代码示例来源:origin: zuihou/zuihou-admin-cloud
/**
* 设置缓存
*
* @param value
*/
@Override
public void set(V value) {
this.getBoundHashOperations().put(this.field(), value);
}
代码示例来源:origin: org.springframework.cloud/spring-cloud-dataflow-admin-starter
@Override
public <S extends StreamDefinition> S save(S entity) {
hashOperations.put(entity.getName(), entity.getDslText());
return entity;
}
代码示例来源:origin: huangjian888/jeeweb-mybatis-springboot
@Override
public void hset(String key, Serializable field, Serializable value) {
getRedisTemplate().boundHashOps(key).put(field, value);
}
代码示例来源:origin: spring-projects/spring-xd-samples
private void storeProductCategoryCount(String category, String product, int count) {
String key = buildLocalKey(category, product);
redisTemplate.boundHashOps(buildRedisKey(product)).put(category, String.valueOf(count));
}
代码示例来源:origin: chengzhx76/weixin-shop-spring-cloud
public void put(String key, String field, Long value) {
BoundHashOperations hashOps = redisTemplate.boundHashOps(key);
redisTemplate.setHashValueSerializer(new GenericToStringSerializer(Long.class));
hashOps.put(field, value);
}
}
代码示例来源:origin: TyCoding/springboot-seckill
@Override
public List<Seckill> findAll() {
List<Seckill> seckillList = redisTemplate.boundHashOps("seckill").values();
if (seckillList == null || seckillList.size() == 0){
//说明缓存中没有秒杀列表数据
//查询数据库中秒杀列表数据,并将列表数据循环放入redis缓存中
seckillList = seckillMapper.findAll();
for (Seckill seckill : seckillList){
//将秒杀列表数据依次放入redis缓存中,key:秒杀表的ID值;value:秒杀商品数据
redisTemplate.boundHashOps(key).put(seckill.getSeckillId(), seckill);
logger.info("findAll -> 从数据库中读取放入缓存中");
}
}else{
logger.info("findAll -> 从缓存中读取");
}
return seckillList;
}
代码示例来源:origin: TyCoding/springboot-seckill
@Override
public Exposer exportSeckillUrl(long seckillId) {
Seckill seckill = (Seckill) redisTemplate.boundHashOps(key).get(seckillId);
if (seckill == null) {
//说明redis缓存中没有此key对应的value
//查询数据库,并将数据放入缓存中
seckill = seckillMapper.findById(seckillId);
if (seckill == null) {
//说明没有查询到
return new Exposer(false, seckillId);
} else {
//查询到了,存入redis缓存中。 key:秒杀表的ID值; value:秒杀表数据
redisTemplate.boundHashOps(key).put(seckill.getSeckillId(), seckill);
logger.info("RedisTemplate -> 从数据库中读取并放入缓存中");
}
} else {
logger.info("RedisTemplate -> 从缓存中读取");
}
Date startTime = seckill.getStartTime();
Date endTime = seckill.getEndTime();
//获取系统时间
Date nowTime = new Date();
if (nowTime.getTime() < startTime.getTime() || nowTime.getTime() > endTime.getTime()) {
return new Exposer(false, seckillId, nowTime.getTime(), startTime.getTime(), endTime.getTime());
}
//转换特定字符串的过程,不可逆的算法
String md5 = getMD5(seckillId);
return new Exposer(true, md5, seckillId);
}
代码示例来源:origin: TyCoding/springboot-seckill
redisTemplate.boundHashOps(key).put(seckillId, seckill);
代码示例来源:origin: dhis2/dhis2-core
summaryKeyToBeDeleted.forEach( d -> redisTemplate.boundHashOps( summaryKey ).delete( d ) );
redisTemplate.boundHashOps( summaryKey ).put( id.getUid(),
objectMapper.writeValueAsString( jobSummary ) );
Date now = new Date();
内容来源于网络,如有侵权,请联系作者删除!