lru

package
v1.0.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCache

func NewCache(option cache.Option) cache.Cache

NewCache return the implementations of cache with LRU algorithm

Types

type Cache

type Cache struct {
	sync.RWMutex

	Option cache.Option
	// contains filtered or unexported fields
}

Cache ...

func (*Cache) ClearCache

func (c *Cache) ClearCache() (err error)

ClearCache ... TODO: (bxcodec) Add Test for this function

func (*Cache) Delete

func (c *Cache) Delete(key string) (err error)

Delete ... TODO: (bxcodec) Add Test for this function

func (*Cache) Get

func (c *Cache) Get(key string) (value interface{}, err error)

Get ... TODO: (bxcodec) Add Test for this function

func (*Cache) GetKeys

func (c *Cache) GetKeys() (keys []string, err error)

GetKeys ... TODO: (bxcodec) Add Test for this function

func (*Cache) Set

func (c *Cache) Set(key string, value interface{}) (err error)

Set ... TODO: (bxcodec) Add Test for this function

type Repository

type Repository interface {
	Set(doc *cache.Document) (err error)
	Get(key string) (res *cache.Document, err error)
	Clear() (err error)
	Contains(key string) (ok bool)
	Delete(key string) (ok bool, err error)
	Keys() (keys []string, err error)
}

Repository ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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