cache

package
v0.0.0-...-8c24509 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2019 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(key string) ([]byte, error)
	Set(key string, content []byte)
	Lock()
	Unlock()
	Reset()
}

Cache mechanism for caching strings

func NewCache

func NewCache() Cache

NewCache create a new cache mechanism

type MemCache

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

MemCache implements a cache mechanism in memory bay using a map

func (*MemCache) Get

func (c *MemCache) Get(key string) (val []byte, err error)

Get return the cached value by a giving key, error if this val not found

func (*MemCache) Lock

func (c *MemCache) Lock()

Lock allow some external resources that uses cache if required, this is not mandatory

func (*MemCache) Reset

func (c *MemCache) Reset()

Reset clear al the cached data

func (*MemCache) Set

func (c *MemCache) Set(key string, data []byte)

Set save data with a giving key in the cache sistem

func (*MemCache) Unlock

func (c *MemCache) Unlock()

Unlock is a required call if you use Lock

Jump to

Keyboard shortcuts

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