memory

package
v0.0.0-...-70c2af6 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryStore

type MemoryStore struct {
	Cache *ttlcache.Cache
}

MemoryStore local memory cache store

func NewMemoryStore

func NewMemoryStore(defaultExpiration time.Duration) *MemoryStore

NewMemoryStore allocate a local memory store with default expiration

func (*MemoryStore) Delete

func (c *MemoryStore) Delete(key string) error

Delete remove key in memory store, do nothing if key doesn't exist

func (*MemoryStore) Get

func (c *MemoryStore) Get(key string, value interface{}) error

Get get key in memory store, if key doesn't exist, return ErrCacheMiss

func (*MemoryStore) Set

func (c *MemoryStore) Set(key string, value interface{}, expireDuration time.Duration) error

Set put key value pair to memory store, and expire after expireDuration

Jump to

Keyboard shortcuts

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