aboutsummaryrefslogtreecommitdiff
path: root/rediscache/main.go
diff options
context:
space:
mode:
authorMitchell Riedstra <mitch@riedstra.dev>2023-01-06 00:04:28 -0500
committerMitchell Riedstra <mitch@riedstra.dev>2023-01-06 00:04:28 -0500
commit1d01acca36b78eeba99da1adb10e72d186433b39 (patch)
treed44fd6268ee26af16acfe720abbd2b3a2e6e5574 /rediscache/main.go
parentad769c34b2f03bffe2c84a8872331838a80c2870 (diff)
downloadgo-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/main.go')
-rw-r--r--rediscache/main.go28
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 (