diff options
| author | Mitchell Riedstra <mitch@riedstra.dev> | 2023-01-06 00:04:28 -0500 |
|---|---|---|
| committer | Mitchell Riedstra <mitch@riedstra.dev> | 2023-01-06 00:04:28 -0500 |
| commit | 1d01acca36b78eeba99da1adb10e72d186433b39 (patch) | |
| tree | d44fd6268ee26af16acfe720abbd2b3a2e6e5574 /rediscache | |
| parent | ad769c34b2f03bffe2c84a8872331838a80c2870 (diff) | |
| download | go-website-1d01acca36b78eeba99da1adb10e72d186433b39.tar.gz go-website-1d01acca36b78eeba99da1adb10e72d186433b39.tar.xz | |
Update site to server configuration via environment variables. Add a genhash command. Update docs.
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 ( |
