1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-22 22:20:50 +00:00

Some updates to cache README

This commit is contained in:
Dobrosław Żybort 2013-06-20 13:58:35 +02:00
parent b886ed59a5
commit b68a37a115

49
cache/README.md vendored
View File

@ -1,52 +1,59 @@
## cache
cache is a golang cache manager. It can use cache for many adapters. The repo is inspired by `database/sql` .
cache is a Go cache manager. It can use many cache adapters. The repo is inspired by `database/sql` .
##How to install
## How to install?
go get github.com/astaxie/beego/cache
##how many adapter support
Now this cache support memory/redis/memcache
## how to use it
first you must import it
## What adapters are supported?
As of now this cache support memory, Memcache and Redis.
## How to use it?
First you must import it
import (
"github.com/astaxie/beego/cache"
)
then init an Cache(memory adapter)
Then init a Cache (example with memory adapter)
bm, err := NewCache("memory", `{"interval":60}`)
use it like this:
Use it like this:
bm.Put("astaxie", 1, 10)
bm.Get("astaxie")
bm.IsExist("astaxie")
bm.Delete("astaxie")
## memory adapter
memory adapter config like this:
## Memory adapter
Configure memory adapter like this:
{"interval":60}
interval means the gc time. The cache will every interval time to check wheather have item expired.
interval means the gc time. The cache will check at each time interval, whether item has expired.
## memcache adapter
memory adapter use the vitess's [memcache](code.google.com/p/vitess/go/memcache) client.
the config like this:
## Memcache adapter
memory adapter use the vitess's [Memcache](http://code.google.com/p/vitess/go/memcache) client.
Configure like this:
{"conn":"127.0.0.1:11211"}
## redis adapter
redis adapter use the [redigo](github.com/garyburd/redigo/redis) client.
## Redis adapter
the config like this:
Redis adapter use the [redigo](http://github.com/garyburd/redigo/redis) client.
{"conn":":6039"}
Configure like this:
{"conn":":6039"}