Go to file
Tyler 43fe2d6511 Add license 2019-10-02 18:08:31 -04:00
LICENSE Add license 2019-10-02 18:08:31 -04:00
README.md Initial commit 2019-10-02 00:10:27 -04:00
cache.go Initial commit 2019-10-02 00:10:27 -04:00
cache_memcache.go Initial commit 2019-10-02 00:10:27 -04:00
cache_redis.go Initial commit 2019-10-02 00:10:27 -04:00
go.mod Initial commit 2019-10-02 00:10:27 -04:00
go.sum Initial commit 2019-10-02 00:10:27 -04:00

README.md

CacheInterface

An experimental interface to use different caches interchangeably via URIs

Example Cache URIs:

redis://server:port?db=0&password=test
memcache://server1:11211,server2:11211

Code

The CacheInterface interface has all methods. All clients will implement this on a best-effort basis.

type CacheInterface interface {
	Has(key string) bool
	Get(key string) ([]byte, error)
	Set(key string, val interface{}, ttl time.Duration) (err error)
	Del(key string) error
}

Note: Set will automatically attempt to store byte arrays and strings directly, and encode the rest with JSON.