12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- 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()
- }
|