-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist.go
More file actions
30 lines (28 loc) · 819 Bytes
/
list.go
File metadata and controls
30 lines (28 loc) · 819 Bytes
1
2
3
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
package red
func (c Client) LPUSH(key Key, value ...string) (length int, err error) {
_, err = c.DoKey(&length, LPUSH, key, value...)
if err != nil {return}
return
}
func (c Client) RPUSH(key Key, value ...string) (length int, err error) {
_, err = c.DoKey(&length, RPUSH, key, value...)
if err != nil {return}
return
}
func (c Client) LPOP(key Key) (value string, hasValue bool, err error) {
empty, err := c.DoKey(&value, LPOP, key)
if err != nil {return}
hasValue = empty.IsNil == false
return
}
func (c Client) RPOP(key Key) (value string, hasValue bool, err error) {
empty, err := c.DoKey(&value, RPOP, key)
if err != nil {return}
hasValue = empty.IsNil == false
return
}
func (c Client) LLEN(key Key) (length int, err error) {
_, err = c.DoKey(&length, LLEN, key)
if err != nil {return}
return
}