123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- package cache
- import "fmt"
- func (p *RedisCache) SCard(key string) (int64, error) {
- if p.isCluster {
- return p.cluster.SCard(key).Result()
- }
- return p.client.SCard(key).Result()
- }
- func (p *RedisCache) SAdd(key string, members ...interface{}) (int64, error) {
- if p.isCluster {
- return p.cluster.SAdd(key, members...).Result()
- }
- return p.client.SAdd(key, members...).Result()
- }
- func (p *RedisCache) SMembers(key string) ([]string, error) {
- if p.isCluster {
- return p.cluster.SMembers(key).Result()
- }
- return p.client.SMembers(key).Result()
- }
- func (p *RedisCache) SIsmember(key string, member interface{}) (bool, error) {
- if p.isCluster {
- return p.cluster.SIsMember(key, member).Result()
- }
- return p.client.SIsMember(key, member).Result()
- }
- func (p *RedisCache) SInter(keys ...string) ([]string, error) {
- if p.isCluster {
- return nil, fmt.Errorf("cluster unsupport <sinter>.")
- }
- return p.client.SInter(keys...).Result()
- }
- func (p *RedisCache) SRem(key string, members ...interface{}) (int64, error) {
- if p.isCluster {
- return p.cluster.SRem(key, members).Result()
- }
- return p.client.SRem(key, members).Result()
- }
|