expirable

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2015 License: Apache-2.0, MIT, MIT Imports: 2 Imported by: 0

README

cache

Simple cache with expirable values

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Expirable

type Expirable interface {
	Expired(baseTime time.Time) bool
	Value() interface{}
}

type KeyValue

type KeyValue struct {
	Key   Keyable
	Value Expirable
}

type Keyable

type Keyable interface{}

type Operation

type Operation int
const (
	Noop Operation = 1 << iota
	Create
	Read
	Update
	Delete
)

type OperationCache

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

func New

func New() *OperationCache

func (*OperationCache) Get

func (oc *OperationCache) Get(k Keyable) (Expirable, bool)

func (*OperationCache) Items

func (oc *OperationCache) Items() chan *KeyValue

func (*OperationCache) Put

func (oc *OperationCache) Put(k Keyable, v Expirable) bool

func (*OperationCache) Remove

func (oc *OperationCache) Remove(k Keyable) (prev Expirable, exist bool)

Jump to

Keyboard shortcuts

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