mem

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2024 License: CC0-1.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCache

func NewCache(url *url.URL) (cache.Cache, error)

NewCache create new memory cache

Types

type MemoryCache

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

MemoryCache memory cache object

func NewMemoryCache

func NewMemoryCache() *MemoryCache

NewMemoryCache new memory instance

func (*MemoryCache) Close

func (m *MemoryCache) Close() error

Close close cache

func (*MemoryCache) Delete

func (m *MemoryCache) Delete(ctx context.Context, key string, opts ...cache.DeleteOptions) error

Delete delete record

func (*MemoryCache) Exist

func (m *MemoryCache) Exist(ctx context.Context, key string) bool

Exist check if key exist

func (*MemoryCache) Get

func (m *MemoryCache) Get(ctx context.Context, key string) ([]byte, error)

Get get value

func (*MemoryCache) GetFloat

func (m *MemoryCache) GetFloat(ctx context.Context, key string) (float64, error)

GetFloat get float value

func (*MemoryCache) GetInt

func (m *MemoryCache) GetInt(ctx context.Context, key string) (int64, error)

GetInt get int value

func (*MemoryCache) GetKeys

func (m *MemoryCache) GetKeys(ctx context.Context, pattern string) []string

func (*MemoryCache) GetObject

func (m *MemoryCache) GetObject(ctx context.Context, key string, doc interface{}) error

GetObject get value in object

func (*MemoryCache) GetString

func (m *MemoryCache) GetString(ctx context.Context, key string) (string, error)

GetString get string value

func (*MemoryCache) Increment

func (m *MemoryCache) Increment(ctx context.Context, key string, expiration int) (int64, error)

func (*MemoryCache) RemainingTime

func (m *MemoryCache) RemainingTime(ctx context.Context, key string) int

RemainingTime get remainig time

func (*MemoryCache) Set

func (m *MemoryCache) Set(ctx context.Context, key string, value interface{}, expiration int) error

Set set value

Jump to

Keyboard shortcuts

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