|
@@ -7,10 +7,7 @@ import java.util.Map;
|
|
import java.util.Set;
|
|
import java.util.Set;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
-import org.springframework.data.redis.core.BoundSetOperations;
|
|
|
|
-import org.springframework.data.redis.core.HashOperations;
|
|
|
|
-import org.springframework.data.redis.core.RedisTemplate;
|
|
|
|
-import org.springframework.data.redis.core.ValueOperations;
|
|
|
|
|
|
+import org.springframework.data.redis.core.*;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -265,4 +262,24 @@ public class RedisCache
|
|
{
|
|
{
|
|
return redisTemplate.keys(pattern);
|
|
return redisTemplate.keys(pattern);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**set集合添加元素
|
|
|
|
+ * @param key Redis键
|
|
|
|
+ * @param value
|
|
|
|
+ * @return 是否成功
|
|
|
|
+ */
|
|
|
|
+ public void addCacheSetValue(final String key, final String value)
|
|
|
|
+ {
|
|
|
|
+ SetOperations<String, String> setOps = redisTemplate.opsForSet();
|
|
|
|
+ setOps.add(key, value);
|
|
|
|
+ }
|
|
|
|
+ /**set集合移除元素
|
|
|
|
+ * @param key Redis键
|
|
|
|
+ * @param member
|
|
|
|
+ * @return 是否成功
|
|
|
|
+ */
|
|
|
|
+ public void removeMemberFromSet(String key, String member) {
|
|
|
|
+ SetOperations<String, String> setOps = redisTemplate.opsForSet();
|
|
|
|
+ setOps.remove(key, member);
|
|
|
|
+ }
|
|
}
|
|
}
|