memory

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 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 Memory

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

Memory is an implementation of cache.Cacher

func New

func New(interval ...time.Duration) *Memory

New return new memory cache. Interval is optional, but if set it will be used for cleanup the expired keys periodically.

func (*Memory) CheckHealth added in v0.2.1

func (m *Memory) CheckHealth(ctx context.Context) error

CheckHealth return health check func.

func (*Memory) Close added in v0.1.8

func (m *Memory) Close(ctx context.Context) error

Close close underlying resources.

func (*Memory) Delete

func (m *Memory) Delete(ctx context.Context, key string) error

Delete a value.

func (*Memory) Get

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

Get a value.

func (*Memory) Open added in v0.1.8

func (m *Memory) Open(ctx context.Context) error

Open make the cacher ready for using.

func (*Memory) Set

func (m *Memory) Set(ctx context.Context, key string, val []byte, opts ...cache.SetOption) error

Set a value.

Jump to

Keyboard shortcuts

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