memory

package
v0.25.15 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrKeyNotExists is key not exists error
	ErrKeyNotExists = errors.New("xcache: the key is not exists")
	// ErrDataTypeNotSupported is data type not supported error
	ErrDataTypeNotSupported = errors.New("xcache: data type is not supported")
	// ErrValueLessThanZero is value less than zero error
	ErrValueLessThanZero = errors.New("xcache: object value is less than zero")
)

Functions

func Author

func Author() string

Author returns package author

func License

func License() string

License returns package license

func Version

func Version() string

Version returns package version

Types

type Object

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

Object is storing single object

type Objects

type Objects struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Objects is storing all object

func New

func New() *Objects

New init a new cache

func (*Objects) Close

func (o *Objects) Close() error

Close stop the cache service

func (*Objects) Decr

func (o *Objects) Decr(key string) error

Decr decrease cache counter

func (*Objects) Del

func (o *Objects) Del(key string) error

Del remove key from cache

func (*Objects) Flush

func (o *Objects) Flush() error

Flush empty the cache

func (*Objects) Get

func (o *Objects) Get(key string) interface{}

Get get value from cache

func (*Objects) Has

func (o *Objects) Has(key string) bool

Has returns key is exists

func (*Objects) Incr

func (o *Objects) Incr(key string) error

Incr increase cache counter

func (*Objects) MGet

func (o *Objects) MGet(key ...string) []interface{}

MGet get multiple value from cache

func (*Objects) Set

func (o *Objects) Set(key string, val interface{}, ttl int64) error

Set set key value to cache

func (*Objects) SetGC

func (o *Objects) SetGC(gcInterval, gcMaxOnce int)

SetGC set gc interval and max once

Jump to

Keyboard shortcuts

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