4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158 | class Hash(BaseCommand):
"""Mixin for Redis Hash commands (e.g. HGET, HSET, HDEL)."""
def __init__(self):
super().__init__()
def hdel(self, *args):
if self._cluster:
return self.execute(
*[b"HDEL", *args],
shard_key=args[0]
)
return self.execute(
*[b"HDEL", *args]
)
def hexists(self, *args):
if self._cluster:
return self.execute(
*[b"HEXISTS", *args],
shard_key=args[0]
)
return self.execute(
*[b"HEXISTS", *args]
)
def hget(self, *args):
if self._cluster:
return self.execute(
*[b"HGET", *args],
shard_key=args[0]
)
return self.execute(
*[b"HGET", *args]
)
def hgetall(self, *args):
if self._cluster:
return self.execute(
*[b"HGETALL", *args],
shard_key=args[0]
)
return self.execute(
*[b"HGETALL", *args]
)
def hincrby(self, *args):
if self._cluster:
return self.execute(
*[b"HINCRBY", *args],
shard_key=args[0]
)
return self.execute(
*[b"HINCRBY", *args]
)
def hincrbyfloat(self, *args):
if self._cluster:
return self.execute(
*[b"HINCRBYFLOAT", *args],
shard_key=args[0]
)
return self.execute(
*[b"HINCRBYFLOAT", *args]
)
def hkeys(self, *args):
if self._cluster:
return self.execute(
*[b"HKEYS", *args],
shard_key=args[0]
)
return self.execute(
*[b"HKEYS", *args]
)
def hlen(self, *args):
if self._cluster:
return self.execute(
*[b"HLEN", *args],
shard_key=args[0]
)
return self.execute(
*[b"HLEN", *args]
)
def hmget(self, *args):
if self._cluster:
return self.execute(
*[b"HMGET", *args],
shard_key=args[0]
)
return self.execute(
*[b"HMGET", *args]
)
def hmset(self, *args):
if self._cluster:
return self.execute(
*[b"HMSET", *args],
shard_key=args[0]
)
return self.execute(
*[b"HMSET", *args]
)
def hset(self, *args):
if self._cluster:
return self.execute(
*[b"HSET", *args],
shard_key=args[0]
)
return self.execute(
*[b"HSET", *args]
)
def hsetnx(self, *args):
if self._cluster:
return self.execute(
*[b"HSETNX", *args],
shard_key=args[0]
)
return self.execute(
*[b"HSETNX", *args]
)
def hstrlen(self, *args):
if self._cluster:
return self.execute(
*[b"HSTRLEN", *args],
shard_key=args[0]
)
return self.execute(
*[b"HSTRLEN", *args]
)
def hvals(self, *args):
if self._cluster:
return self.execute(
*[b"HVALS", *args],
shard_key=args[0]
)
return self.execute(
*[b"HVALS", *args]
)
def hscan(self, *args):
if self._cluster:
return self.execute(
*[b"HSCAN", *args],
shard_key=args[0]
)
return self.execute(
*[b"HSCAN", *args]
)
|