github.com/astaxie/beego@v1.12.3/cache/README.md (about)

     1  ## cache
     2  cache is a Go cache manager. It can use many cache adapters. The repo is inspired by `database/sql` .
     3  
     4  
     5  ## How to install?
     6  
     7  	go get github.com/astaxie/beego/cache
     8  
     9  
    10  ## What adapters are supported?
    11  
    12  As of now this cache support memory, Memcache and Redis.
    13  
    14  
    15  ## How to use it?
    16  
    17  First you must import it
    18  
    19  	import (
    20  		"github.com/astaxie/beego/cache"
    21  	)
    22  
    23  Then init a Cache (example with memory adapter)
    24  
    25  	bm, err := cache.NewCache("memory", `{"interval":60}`)	
    26  
    27  Use it like this:	
    28  	
    29  	bm.Put("astaxie", 1, 10 * time.Second)
    30  	bm.Get("astaxie")
    31  	bm.IsExist("astaxie")
    32  	bm.Delete("astaxie")
    33  
    34  
    35  ## Memory adapter
    36  
    37  Configure memory adapter like this:
    38  
    39  	{"interval":60}
    40  
    41  interval means the gc time. The cache will check at each time interval, whether item has expired.
    42  
    43  
    44  ## Memcache adapter
    45  
    46  Memcache adapter use the [gomemcache](http://github.com/bradfitz/gomemcache) client.
    47  
    48  Configure like this:
    49  
    50  	{"conn":"127.0.0.1:11211"}
    51  
    52  
    53  ## Redis adapter
    54  
    55  Redis adapter use the [redigo](http://github.com/gomodule/redigo) client.
    56  
    57  Configure like this:
    58  
    59  	{"conn":":6039"}