Documentation
¶
Index ¶
- Constants
- type CacheService
- func (s *CacheService) CacheDoc2XResponse(ctx context.Context, md5Hash string, response interface{}) error
- func (s *CacheService) CacheDocument(ctx context.Context, docID string, document interface{}) error
- func (s *CacheService) CacheEmbedding(ctx context.Context, text string, embedding []float32) error
- func (s *CacheService) CacheSearchResults(ctx context.Context, query string, results interface{}) error
- func (s *CacheService) ClearCache(ctx context.Context, _ string) error
- func (s *CacheService) DeleteSession(ctx context.Context, sessionID string) error
- func (s *CacheService) GetCounter(ctx context.Context, name string) (int64, error)
- func (s *CacheService) GetDoc2XResponse(ctx context.Context, md5Hash string, dest interface{}) error
- func (s *CacheService) GetDocument(ctx context.Context, docID string, dest interface{}) error
- func (s *CacheService) GetEmbedding(ctx context.Context, text string) ([]float32, error)
- func (s *CacheService) GetSearchResults(ctx context.Context, query string, dest interface{}) error
- func (s *CacheService) GetSession(ctx context.Context, sessionID string, dest interface{}) error
- func (s *CacheService) GetUserData(ctx context.Context, userID string, field string, dest interface{}) error
- func (s *CacheService) IncrementCounter(ctx context.Context, name string, ttl time.Duration) (int64, error)
- func (s *CacheService) InvalidateDocument(ctx context.Context, docID string) error
- func (s *CacheService) InvalidateUserData(ctx context.Context, userID string, fields ...string) error
- func (s *CacheService) SetCounter(ctx context.Context, name string, value int64, ttl time.Duration) error
- func (s *CacheService) SetSession(ctx context.Context, sessionID string, data interface{}, ttl time.Duration) error
- func (s *CacheService) SetUserData(ctx context.Context, userID string, field string, value interface{}, ...) error
- type Client
- func (c *Client) Close()
- func (c *Client) Delete(ctx context.Context, keys ...string) error
- func (c *Client) DeleteHashFields(ctx context.Context, key string, fields ...string) error
- func (c *Client) Exists(ctx context.Context, key string) (bool, error)
- func (c *Client) FlushDB(ctx context.Context) error
- func (c *Client) Get(ctx context.Context, key string) (string, error)
- func (c *Client) GetHash(ctx context.Context, key string) (map[string]string, error)
- func (c *Client) GetHashField(ctx context.Context, key, field string) (string, error)
- func (c *Client) GetJSON(ctx context.Context, key string, dest interface{}) error
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) Set(ctx context.Context, key string, value string, expiration time.Duration) error
- func (c *Client) SetHash(ctx context.Context, key string, fields map[string]string, ...) error
- func (c *Client) SetJSON(ctx context.Context, key string, value interface{}, expiration time.Duration) error
- type ClientOptions
- type RedisClient
Constants ¶
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheService ¶
type CacheService struct {
// contains filtered or unexported fields
}
func NewCacheService ¶
func NewCacheService(client *Client) *CacheService
func (*CacheService) CacheDoc2XResponse ¶
func (s *CacheService) CacheDoc2XResponse(ctx context.Context, md5Hash string, response interface{}) error
Doc2X helpers
func (*CacheService) CacheDocument ¶
func (s *CacheService) CacheDocument(ctx context.Context, docID string, document interface{}) error
func (*CacheService) CacheEmbedding ¶
func (*CacheService) CacheSearchResults ¶
func (s *CacheService) CacheSearchResults(ctx context.Context, query string, results interface{}) error
func (*CacheService) ClearCache ¶
func (s *CacheService) ClearCache(ctx context.Context, _ string) error
func (*CacheService) DeleteSession ¶
func (s *CacheService) DeleteSession(ctx context.Context, sessionID string) error
func (*CacheService) GetCounter ¶
func (*CacheService) GetDoc2XResponse ¶
func (s *CacheService) GetDoc2XResponse(ctx context.Context, md5Hash string, dest interface{}) error
func (*CacheService) GetDocument ¶
func (s *CacheService) GetDocument(ctx context.Context, docID string, dest interface{}) error
func (*CacheService) GetEmbedding ¶
func (*CacheService) GetSearchResults ¶
func (s *CacheService) GetSearchResults(ctx context.Context, query string, dest interface{}) error
func (*CacheService) GetSession ¶
func (s *CacheService) GetSession(ctx context.Context, sessionID string, dest interface{}) error
func (*CacheService) GetUserData ¶
func (*CacheService) IncrementCounter ¶
func (*CacheService) InvalidateDocument ¶
func (s *CacheService) InvalidateDocument(ctx context.Context, docID string) error
func (*CacheService) InvalidateUserData ¶
func (*CacheService) SetCounter ¶
func (*CacheService) SetSession ¶
func (*CacheService) SetUserData ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements RedisClient using rueidis.
func NewClient ¶
func NewClient(opts ClientOptions) (*Client, error)
func (*Client) DeleteHashFields ¶
func (*Client) GetHashField ¶
type ClientOptions ¶
type ClientOptions struct {
Host string `validate:"required"`
Port int `validate:"min=1,max=65535"`
Password string // optional
DB int `validate:"min=0,max=15"`
}
ClientOptions holds configuration for Redis client creation.
type RedisClient ¶
type RedisClient interface {
// Basic operations
Set(ctx context.Context, key string, value string, expiration time.Duration) error
Get(ctx context.Context, key string) (string, error)
Delete(ctx context.Context, keys ...string) error
Exists(ctx context.Context, key string) (bool, error)
// JSON operations
SetJSON(ctx context.Context, key string, value interface{}, expiration time.Duration) error
GetJSON(ctx context.Context, key string, dest interface{}) error
// Hash operations
SetHash(ctx context.Context, key string, fields map[string]string, expiration time.Duration) error
GetHash(ctx context.Context, key string) (map[string]string, error)
GetHashField(ctx context.Context, key, field string) (string, error)
DeleteHashFields(ctx context.Context, key string, fields ...string) error
// Utility operations
Ping(ctx context.Context) error
FlushDB(ctx context.Context) error
Close()
}
RedisClient defines the interface for Redis operations. This interface enables easier testing and potential implementation swapping.
Click to show internal directories.
Click to hide internal directories.