Documentation
¶
Overview ¶
Package redisengine runs an in-process Redis-protocol server (miniredis) on an allocator-provided or ephemeral port.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrBadSnapshot = errors.New("invalid engine snapshot data")
ErrBadSnapshot is returned when snapshot data cannot be decoded.
Functions ¶
func DumpKeyspace ¶
DumpKeyspace is Snapshot for a bare miniredis server. A nil server yields nil.
Types ¶
type Engine ¶
type Engine struct {
Mini *miniredis.Miniredis
Host string
Port int
AllocatedPort int
// contains filtered or unexported fields
}
Engine is a running in-process Redis-protocol server.
func Start ¶
Start launches a server. With a non-nil allocator the port is acquired from it under label and bound on all interfaces; otherwise an ephemeral loopback port is used.
func (*Engine) Close ¶
func (e *Engine) Close()
Close stops the server and releases its allocated port. Nil-safe and idempotent.
func (*Engine) Restore ¶
Restore loads a blob produced by Snapshot into the engine, overwriting existing keys of the same name. Empty data is a no-op.