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>
This commit is contained in:
+9
@@ -8,9 +8,18 @@ import (
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user