oli-g / cache

Caching package for Go

Home Page:https://godoc.org/github.com/koding/cache

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cache GoDoc Build Status

Cache is a backend provider for common use cases

Install and Usage

Install the package with:

go get github.com/koding/cache

Import it with:

import "github.com/koding/cache"

Example

// create a cache with 2 second TTL
cache := NewMemoryWithTTL(2 * time.Second)
// start garbage collection for expired keys
cache.StartGC(time.Millisecond * 10)
// set item
err := cache.Set("test_key", "test_data")
// get item
data, err := cache.Get("test_key")

About

Caching package for Go

https://godoc.org/github.com/koding/cache


Languages

Language:Go 100.0%