forked from redis/rueidis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmds.go
28 lines (24 loc) · 1020 Bytes
/
cmds.go
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
package rueidis
import "github.com/rueian/rueidis/internal/cmds"
// Completed represents a completed Redis command, should be created by the Build() of command builder.
type Completed = cmds.Completed
// Cacheable represents a completed Redis command which supports server-assisted client side caching,
// and it should be created by the Cache() of command builder.
type Cacheable = cmds.Cacheable
// Commands is an exported alias to []Completed.
// This allows users to store commands for later usage, for example:
//
// c, release := client.Dedicate()
// defer release()
//
// cmds := make(rueidis.Commands, 0, 10)
// for i := 0; i < 10; i++ {
// cmds = append(cmds, c.B().Set().Key(strconv.Itoa(i)).Value(strconv.Itoa(i)).Build())
// }
// for _, resp := range c.DoMulti(ctx, cmds...) {
// if err := resp.Error(); err != nil {
// panic(err)
// }
//
// However, please know that once commands are processed by the Do() or DoMulti(), they are recycled and should not be reused.
type Commands []Completed