Java Code Examples for org.springframework.data.redis.core.BoundSetOperations#add()

The following examples show how to use org.springframework.data.redis.core.BoundSetOperations#add() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RedisCache.java    From RuoYi-Vue with MIT License 5 votes vote down vote up
/**
 * 缓存Set
 *
 * @param key 缓存键值
 * @param dataSet 缓存的数据
 * @return 缓存数据的对象
 */
public <T> BoundSetOperations<String, T> setCacheSet(String key, Set<T> dataSet)
{
    BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
    Iterator<T> it = dataSet.iterator();
    while (it.hasNext())
    {
        setOperation.add(it.next());
    }
    return setOperation;
}
 
Example 2
Source File: RedisCacheService.java    From DimpleBlog with Apache License 2.0 5 votes vote down vote up
/**
 * 缓存Set
 *
 * @param key     缓存键值
 * @param dataSet 缓存的数据
 * @return 缓存数据的对象
 */
public <T> BoundSetOperations<String, T> setCacheSet(String key, Set<T> dataSet) {
    BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
    Iterator<T> it = dataSet.iterator();
    while (it.hasNext()) {
        setOperation.add(it.next());
    }
    return setOperation;
}
 
Example 3
Source File: RedisListenerContainerTaskExecutorITests.java    From spring-session with Apache License 2.0 5 votes vote down vote up
@Test
void testRedisDelEventsAreDispatchedInSessionTaskExecutor() throws InterruptedException {
	BoundSetOperations<Object, Object> ops = this.redis
			.boundSetOps("spring:session:RedisListenerContainerTaskExecutorITests:expirations:dummy");
	ops.add("value");
	ops.remove("value");
	assertThat(this.executor.taskDispatched()).isTrue();

}