Documentation
¶
Index ¶
- type CacheClientInterface
- type Client
- func (c *Client) Close() error
- func (c *Client) Delete(ctx context.Context, keys ...string) error
- func (c *Client) Exists(ctx context.Context, key string) (bool, error)
- func (c *Client) Expire(ctx context.Context, key string, expiration time.Duration) error
- func (c *Client) Get(ctx context.Context, key string) (string, error)
- func (c *Client) HGet(ctx context.Context, key string, field string) (string, error)
- func (c *Client) HGetAll(ctx context.Context, key string) (map[string]string, error)
- func (c *Client) HSet(ctx context.Context, key string, field string, value interface{}) error
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) error
- func (c *Client) SetNX(ctx context.Context, key string, value interface{}, expiration time.Duration) (bool, error)
- type Config
- type NoopClient
- func (c *NoopClient) Close() error
- func (c *NoopClient) Delete(ctx context.Context, keys ...string) error
- func (c *NoopClient) Exists(ctx context.Context, key string) (bool, error)
- func (c *NoopClient) Expire(ctx context.Context, key string, expiration time.Duration) error
- func (c *NoopClient) Get(ctx context.Context, key string) (string, error)
- func (c *NoopClient) HGet(ctx context.Context, key string, field string) (string, error)
- func (c *NoopClient) HGetAll(ctx context.Context, key string) (map[string]string, error)
- func (c *NoopClient) HSet(ctx context.Context, key string, field string, value interface{}) error
- func (c *NoopClient) Ping(ctx context.Context) error
- func (c *NoopClient) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) error
- func (c *NoopClient) SetNX(ctx context.Context, key string, value interface{}, expiration time.Duration) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheClientInterface ¶
type CacheClientInterface interface {
Get(ctx context.Context, key string) (string, error)
Set(ctx context.Context, key string, value interface{}, expiration time.Duration) error
Delete(ctx context.Context, keys ...string) error
Exists(ctx context.Context, key string) (bool, error)
SetNX(ctx context.Context, key string, value interface{}, expiration time.Duration) (bool, error)
Expire(ctx context.Context, key string, expiration time.Duration) error
HSet(ctx context.Context, key string, field string, value interface{}) error
HGet(ctx context.Context, key string, field string) (string, error)
HGetAll(ctx context.Context, key string) (map[string]string, error)
Ping(ctx context.Context) error
Close() error
}
CacheClientInterface defines the interface for cache operations
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps Valkey (Redis) functionality
type Config ¶
type Config struct {
Address string
Username string
Password string
DB int
PoolSize int
Timeout time.Duration
UseTLS bool
}
Config holds Valkey client configuration
type NoopClient ¶
type NoopClient struct {
// contains filtered or unexported fields
}
NoopClient is a no-operation implementation of CacheClientInterface that stores data in memory without using Redis/Valkey. Useful for testing and development without cache infrastructure.
func NewNoopClient ¶
func NewNoopClient(logger *slog.Logger) *NoopClient
NewNoopClient creates a new noop Valkey client
func (*NoopClient) Delete ¶
func (c *NoopClient) Delete(ctx context.Context, keys ...string) error
Delete removes values from in-memory storage
func (*NoopClient) Ping ¶
func (c *NoopClient) Ping(ctx context.Context) error
Ping always returns nil (no actual connection to check)
Click to show internal directories.
Click to hide internal directories.