diff options
Diffstat (limited to 'rediscache')
| -rw-r--r-- | rediscache/main.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/rediscache/main.go b/rediscache/main.go index 04ca622..3cbfdea 100644 --- a/rediscache/main.go +++ b/rediscache/main.go @@ -1,3 +1,31 @@ +// Package rediscache is a piece of middleware you can use to drastically +// improve the performance of any HTTP handler that returns mostly static +// content. +// +// Usage is pretty straightforward: +// +// redisAddr = "localhost:6379" +// rp := &redis.Pool{ +// MaxIdle: 80, +// MaxActive: 12000, +// Dial: func() (redis.Conn, error) { +// c, err := redis.Dial("tcp", redisAddr) +// +// if strings.HasPrefix(redisAddr, "unix:") { +// c, err = redis.Dial("unix", strings.TrimPrefix(redisAddr, "unix:")) +// } +// +// if err != nil { +// log.Println("Redis dial error: ", err) +// } +// +// return c, err +// }, +// } +// +// handler := rediscache.HandleWIthParams(rp, "some-key", someHandler) +// // This handler will continue to serve up the cached output until then +// // key is cleared in redis package rediscache import ( |
