mem

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2021 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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) 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) 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) 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