Documentation
¶
Index ¶
- func ConnectURL(url string) (*goredis.Client, error)
- func NormalizeKeyPrefix(prefix string) string
- type CacheStore
- func (s *CacheStore) CompareAndSubtract(key string, expected int64) (int64, error)
- func (s *CacheStore) Delete(key string) error
- func (s *CacheStore) DeleteByPrefix(ctx context.Context, prefix string) error
- func (s *CacheStore) DeleteExpired(ctx context.Context) (int64, error)
- func (s *CacheStore) Get(key string, dest any) (bool, error)
- func (s *CacheStore) Incr(key string, delta int64, ttl time.Duration) (int64, error)
- func (s *CacheStore) Set(key string, value any, ttl time.Duration) error
- type Config
- type JobQueue
- type QueueConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectURL ¶
ConnectURL parses url, creates a client, and verifies connectivity with PING.
func NormalizeKeyPrefix ¶
NormalizeKeyPrefix ensures a non-empty prefix ends with ":".
Types ¶
type CacheStore ¶
type CacheStore struct {
// contains filtered or unexported fields
}
CacheStore implements cache.Cache using Redis.
func New ¶
func New(cfg Config) (*CacheStore, error)
New creates a CacheStore and verifies the Redis connection with PING.
func (*CacheStore) CompareAndSubtract ¶
func (s *CacheStore) CompareAndSubtract(key string, expected int64) (int64, error)
CompareAndSubtract subtracts expected from the counter when current >= expected. When current < expected, leaves the value unchanged and returns current.
func (*CacheStore) Delete ¶
func (s *CacheStore) Delete(key string) error
Delete removes the entry for key. A missing key is not an error.
func (*CacheStore) DeleteByPrefix ¶
func (s *CacheStore) DeleteByPrefix(ctx context.Context, prefix string) error
DeleteByPrefix removes all entries whose key starts with prefix.
func (*CacheStore) DeleteExpired ¶
func (s *CacheStore) DeleteExpired(ctx context.Context) (int64, error)
DeleteExpired is a no-op for Redis; TTL keys are evicted by the server.
func (*CacheStore) Get ¶
func (s *CacheStore) Get(key string, dest any) (bool, error)
Get retrieves the cached value for key and unmarshals it into dest.
type JobQueue ¶
type JobQueue struct {
// contains filtered or unexported fields
}
JobQueue implements jobs.Queue using Redis lists and a delayed sorted set.
func NewJobQueue ¶
func NewJobQueue(cfg QueueConfig) (*JobQueue, error)
NewJobQueue creates a JobQueue and verifies the Redis connection with PING.
type QueueConfig ¶
QueueConfig holds Redis job queue connection settings.