gocache

package
v0.0.0-...-9c67cfd Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2013 License: MIT Imports: 4 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoCache

type GoCache struct {
	Cache *cache.Cache
	// contains filtered or unexported fields
}

func New

func New(defaultExpirationSeconds, cleanupIntervalSeconds int) *GoCache

Creates a new GoCache with the given intervals defaultExpiration = 0 is never expire cleanupInterval = 0 is never attempt to clean up expired

func (*GoCache) Delete

func (this *GoCache) Delete(key string)

Deletes the value at the requested key

func (*GoCache) Get

func (this *GoCache) Get(key string) ([]byte, bool)

Gets the value at the requested key

func (*GoCache) Inc

func (this *GoCache) Inc(key string, val int64, expireSeconds int) (int64, error)

Increment the key by val (val is allowed to be negative) in most implementation expireSeconds will be from the first increment, but users should not count on that. if no value is a present it should be added. If a value is present which is not a number an error should be returned.

func (*GoCache) Set

func (this *GoCache) Set(key string, value []byte, expireSeconds int)

func (*GoCache) SetIfAbsent

func (this *GoCache) SetIfAbsent(key string, value []byte, expireSeconds int) bool

Sets the value if and only if there is no value associated with this key

Jump to

Keyboard shortcuts

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