Documentation
¶
Index ¶
- Constants
- Variables
- func New(cfg *cachev1.CacheConfig, _ ...options.Option) (storageiface.Cache, error)
- type Cache
- func (c *Cache) Clear(ctx context.Context) error
- func (c *Cache) Close(ctx context.Context) error
- func (c *Cache) Delete(ctx context.Context, key string) error
- func (c *Cache) Exists(ctx context.Context, key string) (bool, error)
- func (c *Cache) Get(ctx context.Context, key string) (string, error)
- func (c *Cache) GetAndDelete(ctx context.Context, key string) (string, error)
- func (c *Cache) Set(ctx context.Context, key string, value string, exp ...time.Duration) error
- type Item
Constants ¶
View Source
const ( DriverName = "memory" // Name of the memory cache driver DefaultSize = 1024 DefaultCapacity = 1024 DefaultExpiration = 0 DefaultCleanupInterval = 300 )
Variables ¶
View Source
var ( ErrKeyNotFound = errors.New("key not found") ErrCacheSizeLimitReached = errors.New("cache size limit reached") )
Functions ¶
func New ¶ added in v0.2.13
func New(cfg *cachev1.CacheConfig, _ ...options.Option) (storageiface.Cache, error)
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is an in-memory cache implementation.
func (*Cache) GetAndDelete ¶
GetAndDelete retrieves the value associated with the given key and deletes it.
Click to show internal directories.
Click to hide internal directories.