memory

package
v0.0.0-...-e417875 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 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(_ 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) Ping

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

Ping ping the cache

func (*Cache) Save

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

Save cache the value by key

func (*Cache) Scan

func (c *Cache) Scan(_ context.Context, match string) (cache.Iterator, error)

Scan scans the keys matched by match string

type ScanIterator

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

ScanIterator is a ScanIterator for memory cache

func (*ScanIterator) Next

func (i *ScanIterator) Next(_ context.Context) bool

Next checks whether has the next element

func (*ScanIterator) Val

func (i *ScanIterator) Val() string

Val returns the key

Jump to

Keyboard shortcuts

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