b68a37a1 by Dobrosław Żybort

Some updates to cache README

1 parent b886ed59
1 ## cache 1 ## cache
2 cache is a golang cache manager. It can use cache for many adapters. The repo is inspired by `database/sql` . 2 cache is a Go cache manager. It can use many cache adapters. The repo is inspired by `database/sql` .
3 3
4 ##How to install 4
5 ## How to install?
5 6
6 go get github.com/astaxie/beego/cache 7 go get github.com/astaxie/beego/cache
7 8
8
9 ##how many adapter support
10 9
11 Now this cache support memory/redis/memcache 10 ## What adapters are supported?
12 11
13 ## how to use it 12 As of now this cache support memory, Memcache and Redis.
14 first you must import it
15 13
16 14
15 ## How to use it?
16
17 First you must import it
18
17 import ( 19 import (
18 "github.com/astaxie/beego/cache" 20 "github.com/astaxie/beego/cache"
19 ) 21 )
20 22
21 then init an Cache(memory adapter) 23 Then init a Cache (example with memory adapter)
22 24
23 bm, err := NewCache("memory", `{"interval":60}`) 25 bm, err := NewCache("memory", `{"interval":60}`)
24 26
25 use it like this: 27 Use it like this:
26 28
27 bm.Put("astaxie", 1, 10) 29 bm.Put("astaxie", 1, 10)
28 bm.Get("astaxie") 30 bm.Get("astaxie")
29 bm.IsExist("astaxie") 31 bm.IsExist("astaxie")
30 bm.Delete("astaxie") 32 bm.Delete("astaxie")
31 33
32 ## memory adapter 34
33 memory adapter config like this: 35 ## Memory adapter
36
37 Configure memory adapter like this:
34 38
35 {"interval":60} 39 {"interval":60}
36 40
37 interval means the gc time. The cache will every interval time to check wheather have item expired. 41 interval means the gc time. The cache will check at each time interval, whether item has expired.
38 42
39 ## memcache adapter
40 memory adapter use the vitess's [memcache](code.google.com/p/vitess/go/memcache) client.
41 43
42 the config like this: 44 ## Memcache adapter
45
46 memory adapter use the vitess's [Memcache](http://code.google.com/p/vitess/go/memcache) client.
47
48 Configure like this:
43 49
44 {"conn":"127.0.0.1:11211"} 50 {"conn":"127.0.0.1:11211"}
45 51
46 52
47 ## redis adapter 53 ## Redis adapter
48 redis adapter use the [redigo](github.com/garyburd/redigo/redis) client. 54
55 Redis adapter use the [redigo](http://github.com/garyburd/redigo/redis) client.
49 56
50 the config like this: 57 Configure like this:
51 58
52 {"conn":":6039"}
...\ No newline at end of file ...\ No newline at end of file
59 {"conn":":6039"}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!