mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 07:30:55 +00:00
Some updates to cache README
This commit is contained in:
parent
b886ed59a5
commit
b68a37a115
41
cache/README.md
vendored
41
cache/README.md
vendored
@ -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
|
||||
## What adapters are supported?
|
||||
|
||||
Now this cache support memory/redis/memcache
|
||||
As of now this cache support memory, Memcache and Redis.
|
||||
|
||||
## how to use it
|
||||
first you must import it
|
||||
|
||||
## 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.
|
||||
|
||||
Configure like this:
|
||||
|
||||
{"conn":":6039"}
|
Loading…
Reference in New Issue
Block a user