mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-06-10 10:10:49 +00:00
6895e369f6
- Remove standalone mode code: file-based stores, standalone gateway, heartbeat service, SQLite memory, standalone docker-compose - Rename docker-compose.managed.yml → docker-compose.postgres.yml - Clean up ~130 Go comments referencing "managed mode" qualifier - Simplify docker-compose.yml env vars (providers/channels via web UI) - Update .env.example to essential vars only (token + encryption key) - Add setup wizard UI (provider → agent → channel bootstrap flow) - Add logs.tail WebSocket handler for live log streaming - Add cursor-pointer to interactive UI components - Clean up config page (remove standalone-only sections) - Update README and docs for managed-only architecture
26 lines
751 B
Go
26 lines
751 B
Go
package cache
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
// Cache is a generic key-value cache interface.
|
|
// Implementations: InMemoryCache (this package), future: Redis, Memcache.
|
|
type Cache[V any] interface {
|
|
// Get retrieves a value by key. Returns the value and true if found, zero value and false if not.
|
|
Get(ctx context.Context, key string) (V, bool)
|
|
|
|
// Set stores a value with an optional TTL. If ttl is 0, the entry never expires.
|
|
Set(ctx context.Context, key string, value V, ttl time.Duration)
|
|
|
|
// Delete removes a single key.
|
|
Delete(ctx context.Context, key string)
|
|
|
|
// DeleteByPrefix removes all keys matching the given prefix.
|
|
DeleteByPrefix(ctx context.Context, prefix string)
|
|
|
|
// Clear removes all entries.
|
|
Clear(ctx context.Context)
|
|
}
|