mcache

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item interface{}

Item 内存缓存单个实例

type MemCache

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

MemCache 内存缓存结构

func NewMCache

func NewMCache() *MemCache

NewMCache New Go MemCache

func (*MemCache) Add

func (m *MemCache) Add(k string, x interface{}) error

Add an item to the MemCache only if an item doesn't already exist for the given

func (*MemCache) Delete

func (m *MemCache) Delete(k string)

Delete an item from the MemCache. Does nothing if the key is not in the MemCache.

func (*MemCache) Flush

func (m *MemCache) Flush()

Flush Delete all items from the MemCache.

func (*MemCache) Get

func (m *MemCache) Get(k string) (interface{}, bool)

Get an item from the MemCache. Returns the item or nil, and a bool indicating whether the key was found.

func (*MemCache) ItemCount

func (m *MemCache) ItemCount() int

ItemCount Returns the number of items in the MemCache. This may include items that have

func (*MemCache) Items

func (m *MemCache) Items() map[string]Item

Items Copies all items in the MemCache into a new map and returns it.

func (*MemCache) Replace

func (m *MemCache) Replace(k string, x interface{}) error

Replace Set a new value for the MemCache key only if it already exists, and the existing

func (*MemCache) Set

func (m *MemCache) Set(k string, x interface{})

Set Add an item to the MemCache, replacing any existing item.

Jump to

Keyboard shortcuts

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