cache

package module
v0.0.0-...-0b70cb8 Latest Latest
Warning

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

Go to latest
Published: May 31, 2018 License: MIT Imports: 3 Imported by: 1

README

Build StatusCoverage Status

cache

A cache for golang

Note: This is almost entirely untested at this point and well be seeing much more development before it is tested or used anywhere. When this is nearly dev-complete, I will generate a godoc along with some examples.

Documentation

Index

Constants

View Source
const (
	CacheStrategyRandom    = CacheStrategy(1)
	CacheStrategyOldest    = CacheStrategy(2)
	CacheStrategyOldestLRU = CacheStrategy(3)
	CacheStrategyLFU       = CacheStrategy(4)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

func NewCache

func NewCache(c CacheOptions) *Cache

func (*Cache) Bump

func (c *Cache) Bump(key string)

func (*Cache) Get

func (c *Cache) Get(key string) interface{}

func (*Cache) Hits

func (c *Cache) Hits() int64

func (*Cache) Len

func (c *Cache) Len() int

For now we, can't use this internally since it is mutex'd

func (*Cache) Misses

func (c *Cache) Misses() int64

func (*Cache) RemoveItem

func (c *Cache) RemoveItem(key string)

func (*Cache) Set

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

func (*Cache) Start

func (c *Cache) Start()

func (*Cache) Stop

func (c *Cache) Stop()

func (*Cache) Trim

func (c *Cache) Trim(num int)

type CacheOptions

type CacheOptions struct {
	MaxEntries     int //If this is set to 0, you must have an expiration time set.
	Upper          int
	CacheStrategy  CacheStrategy
	ExpirationTime time.Duration
	JobInvertal    time.Duration
	SafeRange      int
}

type CacheStrategy

type CacheStrategy int

type CachedItem

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

Jump to

Keyboard shortcuts

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