memory

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrInvalidConnectionState indicate that the connection has not been opened properly.
	ErrInvalidConnectionState = errors.New("invalid connection state")
)

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(size int) *Memory

New return new memory cache.

func (*Memory) CheckHealth

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

CheckHealth return health check func.

func (*Memory) Close

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

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.

type Option

type Option func(*Memory)

Jump to

Keyboard shortcuts

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