zabio3 / glc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go Local Cache

GoDoc Go Report Card

Go Local Cache provides a simple cache mechanism for storing locally.
Go Local Cache currently only supports in-memory cache, but will also support file cache.

Installation

go get github.com/emahiro/glc

Usage

in memory cache

mc := glc.NewMemoryCache(glc.DefaultMemoryCacheExpires)

// Set
if err := mc.Set("cacheKey", []byte('hoge')); err != nil {
    log.Fatal(err)
}

// Get

data := mc.Get("cacheKey")

file cache

Usage is similar to in memory cache.
Go Local Cache creates tmp directory for file cache.

LICENSE

MIT

About

License:MIT License


Languages

Language:Go 100.0%