Documentation
¶
Overview ¶
Package redis implements basic connections and pooling to redis servers.
This package operates with streams of data (io.Reader). As necessry the package will cache data locally before read by clients, for example when reading successive elements of an array before consuming each element's contents.
Index ¶
- type Cmd
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) Command(command string, args int) (*Cmd, error)
- func (c *Conn) Destroy() error
- func (c *Conn) RawCmd(command string, args ...string) error
- func (c *Conn) Resp() *resp.RESP
- func (c *Conn) Subscribe(channel string, messages chan<- *resp.RESP) error
- func (c *Conn) Unsubscribe(channel string, ch chan<- *resp.RESP)
- type Pool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cmd ¶
Cmd is a command that is currently being written to a connection.
func (Cmd) WriteArgument ¶
WriteArgument is a shortcut method to write a reader to a command. If at all possible, WriteArgumentLength should be used instead.
func (Cmd) WriteArgumentLength ¶
WriteArgumentLength copies a reader as an argument to a command. It expects the reader to be of the given length.
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn represents an open connection to a redis server.
func DialTimeout ¶
DialTimeout acts like Dial but takes a timeout. The timeout includes name resolution, if required.
func (*Conn) Close ¶
Close either releases the connection back into the pool from whence it came, or, it actually destroys the connection.
func (*Conn) Command ¶
Command initializes a command with the given number of arguments. The connection only allows one open command at a time and will block callers to prevent jumbled queues.
func (*Conn) Subscribe ¶
Subscribe listens on c for published messages on the a channel. This method will either return an error right away or block while sending received messages on the messges channel until it receives a signal on the done channel. This connection should not be reused for another purpose.
type Pool ¶
type Pool struct {
Network, Server string
// Password indicates that new connections should initially authenticate
// with the given password. Password is ignored if empty.
Password string
// MaxIdle indicates how many idle connections should be kept. Zero indicates
// all idle connections should be preserved.
MaxIdle int
ConnTimeout time.Duration
// contains filtered or unexported fields
}
Pool maintains a collection of idle Redis connections.
func (*Pool) Conn ¶
Conn attempts to get or create a connection, depending on if there are any idle connections.
Directories
¶
| Path | Synopsis |
|---|---|
|
Command redis is a CLI for redis.
|
Command redis is a CLI for redis. |
|
Package resp implements the REdis Serialization Protocol with the particular aim to communicate with Redis.
|
Package resp implements the REdis Serialization Protocol with the particular aim to communicate with Redis. |