Documentation
¶
Overview ¶
Package cache provides Redis cache abstraction.
Index ¶
- type Cache
- type RedisCache
- func (c *RedisCache) Delete(ctx context.Context, key string) error
- func (c *RedisCache) Exists(ctx context.Context, key string) (bool, error)
- func (c *RedisCache) Get(ctx context.Context, key string, dest any) error
- func (c *RedisCache) Set(ctx context.Context, key string, value any, expiration time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
Get(ctx context.Context, key string, dest any) error
Set(ctx context.Context, key string, value any, expiration time.Duration) error
Delete(ctx context.Context, key string) error
Exists(ctx context.Context, key string) (bool, error)
}
Cache provides a simple cache interface.
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
RedisCache implements Cache using Redis.
func NewRedisCache ¶
func NewRedisCache(client *redis.Client, prefix string) *RedisCache
NewRedisCache creates a new Redis cache.
func (*RedisCache) Delete ¶
func (c *RedisCache) Delete(ctx context.Context, key string) error
Delete removes a value from cache.
Click to show internal directories.
Click to hide internal directories.