Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Description ¶
Description appends standard feature descriptions to a cache description based on various features of the cache.
Types ¶
type V2 ¶ added in v3.47.0
type V2 interface {
// Get a cache item.
Get(ctx context.Context, key string) ([]byte, error)
// Set a cache item, specifying an optional TTL. It is okay for caches to
// ignore the ttl parameter if it isn't possible to implement.
Set(ctx context.Context, key string, value []byte, ttl *time.Duration) error
// SetMulti sets one or more cache items within as few requests as possible.
SetMulti(ctx context.Context, keyValues map[string]types.CacheTTLItem) error
// Add is the same operation as Set except that it returns an error if the
// key already exists. It is okay for caches to return nil on duplicates if
// it isn't possible to implement.
Add(ctx context.Context, key string, value []byte, ttl *time.Duration) error
// Delete attempts to remove a key. If the key does not exist then it is
// considered correct to return an error, however, for cache implementations
// where it is difficult to determine this then it is acceptable to return
// nil.
Delete(ctx context.Context, key string) error
// Close the component, blocks until either the underlying resources are
// cleaned up or the context is cancelled. Returns an error if the context
// is cancelled.
Close(ctx context.Context) error
}
V2 is a simpler interface to implement than types.Cache.
Click to show internal directories.
Click to hide internal directories.