Files
auth/rbac/cache.go
T

17 lines
548 B
Go
Raw Permalink Normal View History

package rbac
import (
"context"
"time"
)
// Cache is the pluggable caching backend for [NewCachedPermissionProvider].
// Satisfied by einherjar/cache-valkey via Go duck typing — no import of auth/rbac needed.
//
// Get returns (value, true, nil) on hit; (0, false, nil) on miss; (0, false, err) on error.
// Set errors are silently ignored by the provider — cache is best-effort.
type Cache interface {
Get(ctx context.Context, key string) (int64, bool, error)
Set(ctx context.Context, key string, value int64, ttl time.Duration) error
}