Documentation
¶
Index ¶
- func DecodeOffsetCursor(cursor string) (int, error)
- func EncodeOffsetCursor(offset int) string
- func ListFilterTerm(opts ListPageOptions) string
- func NormalizeListLimit(limit int) int
- type BaseConfig
- type CacheEntry
- type CompressionCodec
- type Driver
- type Inspector
- type InspectorCapabilities
- type ListPageOptions
- type ListPageResult
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeOffsetCursor ¶ added in v0.2.0
func EncodeOffsetCursor ¶ added in v0.2.0
func ListFilterTerm ¶ added in v0.2.0
func ListFilterTerm(opts ListPageOptions) string
func NormalizeListLimit ¶ added in v0.2.0
Types ¶
type BaseConfig ¶
type BaseConfig struct {
DefaultTTL time.Duration
Prefix string
Compression CompressionCodec
MaxValueBytes int
EncryptionKey []byte
}
BaseConfig contains shared, backend-agnostic driver configuration.
type CacheEntry ¶ added in v0.2.0
func FilterAndSortEntries ¶ added in v0.2.0
func FilterAndSortEntries(entries []CacheEntry, filter string) []CacheEntry
type CompressionCodec ¶
type CompressionCodec string
CompressionCodec represents a value compression algorithm.
const ( CompressionNone CompressionCodec = "none" CompressionGzip CompressionCodec = "gzip" CompressionSnappy CompressionCodec = "snappy" )
type Inspector ¶ added in v0.2.0
type Inspector interface {
Capabilities() InspectorCapabilities
ListPage(ctx context.Context, opts ListPageOptions) (ListPageResult, error)
}
Inspector is an optional cache store extension for safe key browsing and metadata inspection.
Not every driver can support this efficiently or at all. Callers should check for support with a type assertion and respect Capabilities().
type InspectorCapabilities ¶ added in v0.2.0
type ListPageOptions ¶ added in v0.2.0
type ListPageResult ¶ added in v0.2.0
type ListPageResult struct {
Entries []CacheEntry
NextCursor string
HasMore bool
}
func SliceEntries ¶ added in v0.2.0
func SliceEntries(entries []CacheEntry, offset int, limit int) ListPageResult
type Store ¶
type Store interface {
Driver() Driver
Ready(ctx context.Context) error
Get(ctx context.Context, key string) ([]byte, bool, error)
Set(ctx context.Context, key string, value []byte, ttl time.Duration) error
Add(ctx context.Context, key string, value []byte, ttl time.Duration) (bool, error)
Increment(ctx context.Context, key string, delta int64, ttl time.Duration) (int64, error)
Decrement(ctx context.Context, key string, delta int64, ttl time.Duration) (int64, error)
Delete(ctx context.Context, key string) error
DeleteMany(ctx context.Context, keys ...string) error
Flush(ctx context.Context) error
}
Store is the shared app cache contract.
Click to show internal directories.
Click to hide internal directories.