Documentation
¶
Overview ¶
Package cache provides Redis caching functionality for the application. It includes connection management, basic operations, and caching utilities.
Index ¶
- Constants
- type Cache
- func (c *Cache) Close() error
- func (c *Cache) Delete(ctx context.Context, key string) error
- func (c *Cache) DeletePattern(ctx context.Context, pattern string) error
- func (c *Cache) Exists(ctx context.Context, key string) (bool, error)
- func (c *Cache) FlushDB(ctx context.Context) error
- func (c *Cache) Get(ctx context.Context, key string, dest any) error
- func (c *Cache) GetClient() *redis.Client
- func (c *Cache) Set(ctx context.Context, key string, value any, ttl time.Duration) error
- func (c *Cache) TTL(ctx context.Context, key string) (time.Duration, error)
- type RedisConfig
Constants ¶
View Source
const ( DefaultTTL = 30 * time.Minute MaxRetries = 3 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache wraps the Redis client and provides caching operations
func NewCache ¶
func NewCache(cfg *RedisConfig, logger *logger.Logger) (*Cache, error)
NewCache initializes a new Redis cache connection
func (*Cache) DeletePattern ¶
DeletePattern removes all keys matching a pattern
func (*Cache) GetClient ¶
func (c *Cache) GetClient() *redis.Client
GetClient returns the underlying Redis client for advanced operations
Click to show internal directories.
Click to hide internal directories.