memory

package
Version: v0.0.0-...-61d74b9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts cache.Options) (cache.Cache, error)

New returns memory cache

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache memory cache

func (*Cache) Contains

func (c *Cache) Contains(ctx context.Context, key string) bool

Contains returns true if key exists

func (*Cache) Delete

func (c *Cache) Delete(ctx context.Context, key string) error

Delete delete item from cache by key

func (*Cache) Fetch

func (c *Cache) Fetch(ctx context.Context, key string, value interface{}) error

Fetch retrieve the cached key value

func (*Cache) Keys

func (c *Cache) Keys(ctx context.Context, prefixes ...string) ([]string, error)

Keys returns the key matched by prefixes.

func (*Cache) Ping

func (c *Cache) Ping(ctx context.Context) error

Ping ping the cache

func (*Cache) Save

func (c *Cache) Save(ctx context.Context, key string, value interface{}, expiration ...time.Duration) error

Save cache the value by key

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL