Documentation
¶
Index ¶
- func NewCache(ctx context.Context, redisClient *redis.Client) repository.CacheInterface
- type TTLCache
- func (c *TTLCache) Get(key string) ([]byte, bool)
- func (c *TTLCache) GetTTL(key string) (time.Duration, bool)
- func (c *TTLCache) Pop(key string) ([]byte, bool)
- func (c *TTLCache) Remove(key string)
- func (c *TTLCache) RemoveByPrefix(prefix string)
- func (c *TTLCache) Set(key string, value []byte, ttl time.Duration)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCache ¶
func NewCache(ctx context.Context, redisClient *redis.Client) repository.CacheInterface
NewCache creates a new TTLCache instance connected to a Redis server.
Types ¶
type TTLCache ¶
type TTLCache struct {
// contains filtered or unexported fields
}
TTLCache is a Redis-based cache with time-to-live (TTL) expiration.
func (*TTLCache) Pop ¶
Pop removes and returns the item with the specified key from the Redis cache.
func (*TTLCache) RemoveByPrefix ¶
RemoveByPrefix removes all items with the specified prefix from the Redis cache.
Click to show internal directories.
Click to hide internal directories.