memory

package
v3.0.0-...-838862a Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache is a wrapper around the go-cache library.

func New

func New() *Cache

New constructs a new in-memory cache.

func NewWithData

func NewWithData(ctx context.Context, data []string) *Cache

NewWithData constructs a new in-memory cache with existing data.

func (*Cache) Clear

func (c *Cache) Clear()

Clear removes all key-value pairs from the cache.

func (*Cache) Contents

func (c *Cache) Contents() string

Contents returns all key-value pairs in the cache encodes as a string.

func (*Cache) Count

func (c *Cache) Count() int

Count returns the number of key-value pairs in the cache.

func (*Cache) Delete

func (c *Cache) Delete(key string)

Delete removes the key-value pair from the cache.

func (*Cache) Exists

func (c *Cache) Exists(key string) bool

Exists returns true if the given key exists in the cache.

func (*Cache) Get

func (c *Cache) Get(key string) (string, bool)

Get returns the value for the given key.

func (*Cache) Keys

func (c *Cache) Keys() []string

Keys returns all keys in the cache.

func (*Cache) Set

func (c *Cache) Set(key, value string)

Set adds a key-value pair to the cache.

func (*Cache) Values

func (c *Cache) Values() []string

Values returns all values in the cache.

Jump to

Keyboard shortcuts

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