Documentation
¶
Index ¶
Constants ¶
View Source
const ( DefaultPoolSize = 10 // DefaultDialTimeout bounds the initial TCP connect (and the AUTH/SELECT // handshake that follows it) when opening or re-opening a connection. DefaultDialTimeout = 5 * time.Second // DefaultCommandTimeout is the read/write deadline applied to every // command sent over a pooled connection, so a server that stops // responding cannot hang a caller (or a pool slot) forever. DefaultCommandTimeout = 5 * time.Second // DefaultMaxBulkLen caps how large a single RESP bulk string ($n) the // client will allocate for. A server (or a man-in-the-middle without // TLS) advertising a bigger length gets an error instead of an // unbounded allocation. DefaultMaxBulkLen = 16 * 1024 * 1024 // DefaultMaxArrayLen caps how many elements a single RESP array (*n) // the client will allocate for, for the same reason. DefaultMaxArrayLen = 1_000_000 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Address string `json:"address"`
Password string `json:"password"`
PoolSize int `json:"pool_size"`
DB int `json:"db"`
UseTLS bool `json:"use_tls"`
// DialTimeout bounds a (re)connect, including the AUTH/SELECT handshake.
DialTimeout time.Duration `json:"dial_timeout"`
// CommandTimeout is the read/write deadline applied to every command.
CommandTimeout time.Duration `json:"command_timeout"`
// MaxBulkLen caps the size the client will allocate for a RESP bulk
// string reply. 0 uses DefaultMaxBulkLen; a negative value disables
// the cap (not recommended).
MaxBulkLen int64 `json:"max_bulk_len"`
// MaxArrayLen caps the number of elements the client will allocate for
// a RESP array reply. 0 uses DefaultMaxArrayLen; a negative value
// disables the cap (not recommended).
MaxArrayLen int64 `json:"max_array_len"`
}
func DefaultConfig ¶
func DefaultConfig() Config
type DeleteResult ¶
type ExistsResult ¶
type KeysResult ¶
type RedisClient ¶
type RedisClient struct {
// contains filtered or unexported fields
}
func NewRedisClient ¶
func NewRedisClient(logger *slog.Logger, cfg Config) (*RedisClient, error)
func (*RedisClient) CallTool ¶
func (c *RedisClient) CallTool(ctx context.Context, name string, args json.RawMessage) (interface{}, error)
func (*RedisClient) Close ¶
func (c *RedisClient) Close()
func (*RedisClient) GetTools ¶
func (c *RedisClient) GetTools() []ToolDefinition
type ToolDefinition ¶
type ToolDefinition struct {
Name string `json:"name"`
Description string `json:"description"`
InputSchema json.RawMessage `json:"inputSchema"`
}
type ToolHandler ¶
type ToolHandler func(ctx context.Context, args json.RawMessage) (interface{}, error)
Click to show internal directories.
Click to hide internal directories.