package cachevalkey import ( "context" "time" vk "github.com/valkey-io/valkey-go" ) // Provider wraps the most common Valkey operations using only standard Go types. // Callers that need operations beyond this interface call Native(). // Component satisfies Provider — pass the result of New() wherever a Provider is expected. type Provider interface { // Get retrieves the string value of key. Returns ("", false, nil) on cache miss. Get(ctx context.Context, key string) (string, bool, error) // Set stores value under key. Pass 0 ttl for no expiry. Set(ctx context.Context, key string, value string, ttl time.Duration) error // Del removes one or more keys. Silently skips non-existent keys. Del(ctx context.Context, keys ...string) error // Exists reports whether key is present. Exists(ctx context.Context, key string) (bool, error) // Expire sets a TTL on an existing key. Expire(ctx context.Context, key string, ttl time.Duration) error // IncrWithTTL atomically increments the integer counter at key and sets // its expiry on first increment. Returns the new counter value. // If key does not exist it is created with value 1. IncrWithTTL(ctx context.Context, key string, ttl time.Duration) (int64, error) // Native returns the underlying valkey-go client for operations not in Provider. Native() vk.Client }