memory

package
v0.0.90 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrNotFound = errors.String("not found")
)

Variables

This section is empty.

Functions

func FreeCache

func FreeCache(config Config) *freecache.Cache

Types

type Cache

type Cache struct {
	Delimiter string
	Cache     *freecache.Cache
}

func NewCache

func NewCache(cfg Config) *Cache

func (*Cache) Close

func (obj *Cache) Close(_ context.Context) error

func (*Cache) Delete

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

func (*Cache) Exists

func (obj *Cache) Exists(ctx context.Context, key string) error

func (*Cache) Get

func (obj *Cache) Get(ctx context.Context, key string) (string, error)

func (*Cache) GetAndDelete

func (obj *Cache) GetAndDelete(ctx context.Context, key string) (string, error)

func (*Cache) Iterator

func (obj *Cache) Iterator(ctx context.Context, fn func(ctx context.Context, key, value string) bool) error

func (*Cache) Set

func (obj *Cache) Set(ctx context.Context, key, value string, expiration ...time.Duration) error

type Config

type Config struct {
	DefaultExpiration time.Duration
	CleanupInterval   time.Duration
}

Jump to

Keyboard shortcuts

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