cache2go

package
v0.0.0-...-48d1953 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2013 License: GPL-3.0, BSD-3-Clause Imports: 3 Imported by: 0

README

cache2go

Golang simple object caching library with expiration capabilities.

See the test file for wroking examples.

API docs here.

Continous integration: Build Status

Documentation

Overview

Simple caching library with expiration capabilities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cache

func Cache(key string, value interface{})

The function to be used to cache a key/value pair when expiration is not needed

func Flush

func Flush()

Delete all keys from cache

func GetCached

func GetCached(key string) (v interface{}, err error)

The function to extract a value for a key that never expire

func GetXCached

func GetXCached(key string) (ece expiringCacheEntry, err error)

Get an entry from the expiration cache and mark it for keeping alive

func XFlush

func XFlush()

Delete all keys from expiraton cache

Types

type XEntry

type XEntry struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Structure that must be embeded in the objectst that must be cached with expiration. If the expiration is not needed this can be ignored

func (*XEntry) KeepAlive

func (xe *XEntry) KeepAlive()

Mark entry to be kept another expirationDuration period

func (*XEntry) XCache

func (xe *XEntry) XCache(key string, expire time.Duration, value expiringCacheEntry)

The main function to cache with expiration

Jump to

Keyboard shortcuts

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