From b68a37a115447f4bc9313fe1f661268671356f00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dobros=C5=82aw=20=C5=BBybort?= Date: Thu, 20 Jun 2013 13:58:35 +0200 Subject: [PATCH] Some updates to cache README --- cache/README.md | 49 ++++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/cache/README.md b/cache/README.md index 93868458..d4c80fad 100644 --- a/cache/README.md +++ b/cache/README.md @@ -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"} \ No newline at end of file +Configure like this: + + {"conn":":6039"}