Files
geo/server/internal/shared/cache/cache.go
T
root c1ef717d17
Deployment Config CI / Deployment Config (push) Successful in 24s
Backend CI / Backend (push) Successful in 14m33s
feat(cache,worker): overhaul cache layer and add generation task lease recovery
- shared/cache: add Options/L1/async/metrics/prefix decorators, multi-key ops, Redis pool tuning, and JSON readthrough metrics
- worker-generate: claim tasks via DB lease + heartbeat, requeue stale queued tasks, expire dead leases with refund/cache invalidation
- tenant: version article cache keys so worker recovery invalidations propagate cleanly
- shared/config: expand Redis (pool/timeouts/TLS) and Generation (lease/recovery) configs with defaults

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 02:02:39 +08:00

26 lines
618 B
Go

package cache
import (
"context"
"errors"
"time"
)
var ErrNotFound = errors.New("cache: key not found")
type Item struct {
Key string
Value []byte
TTL time.Duration
}
type Cache interface {
Get(ctx context.Context, key string) ([]byte, error)
GetMulti(ctx context.Context, keys []string) (map[string][]byte, error)
Set(ctx context.Context, key string, value []byte, ttl time.Duration) error
SetMulti(ctx context.Context, items []Item) error
Delete(ctx context.Context, key string) error
DeleteMany(ctx context.Context, keys []string) error
DeletePrefix(ctx context.Context, prefix string) error
}