List of usage examples for org.springframework.data.redis.support.collections RedisSet getKey
K getKey();
From source file:com.afousan.service.RetwisRepository.java
public List<String> alsoFollowed(String uid, String targetUid) { RedisSet<String> tempSet = following(uid).intersectAndStore(followers(targetUid), KeyUtils.alsoFollowed(uid, targetUid)); String key = tempSet.getKey(); template.expire(key, 5, TimeUnit.SECONDS); return covertUidsToNames(key); }
From source file:com.afousan.service.RetwisRepository.java
public List<String> commonFollowers(String uid, String targetUid) { RedisSet<String> tempSet = following(uid).intersectAndStore(following(targetUid), KeyUtils.commonFollowers(uid, targetUid)); tempSet.expire(5, TimeUnit.SECONDS); return covertUidsToNames(tempSet.getKey()); }
From source file:org.springframework.integration.redis.outbound.RedisCollectionPopulatingMessageHandler.java
@SuppressWarnings("unchecked") private void handleSet(final RedisSet<Object> set, Message<?> message) { final Object payload = message.getPayload(); if (this.extractPayloadElements && payload instanceof Collection<?>) { final BoundSetOperations<String, Object> ops = (BoundSetOperations<String, Object>) this.redisTemplate .boundSetOps(set.getKey()); this.processInPipeline(new PipelineCallback() { public void process() { for (Object object : ((Collection<?>) payload)) { ops.add(object);/*w w w . jav a 2 s . com*/ } } }); } else { set.add(payload); } }
From source file:org.springframework.integration.redis.outbound.RedisStoreWritingMessageHandler.java
@SuppressWarnings("unchecked") private void writeToSet(final RedisSet<Object> set, Message<?> message) { final Object payload = message.getPayload(); if (this.extractPayloadElements && payload instanceof Collection<?>) { final BoundSetOperations<String, Object> ops = (BoundSetOperations<String, Object>) this.redisTemplate .boundSetOps(set.getKey()); this.processInPipeline(new PipelineCallback() { public void process() { for (Object object : ((Collection<?>) payload)) { ops.add(object);//from w w w. j av a 2 s. c om } } }); } else { set.add(payload); } }