From 1d01acca36b78eeba99da1adb10e72d186433b39 Mon Sep 17 00:00:00 2001 From: Mitchell Riedstra Date: Fri, 6 Jan 2023 00:04:28 -0500 Subject: Update site to server configuration via environment variables. Add a genhash command. Update docs. --- rediscache/main.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'rediscache') 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 ( -- cgit v1.2.3