From e0d4a3e50921dc07e23ef9aa107bdc78b3adf176 Mon Sep 17 00:00:00 2001 From: Mitchell Riedstra Date: Sun, 24 Oct 2021 13:10:20 -0400 Subject: Use hash in redis. Key can be set in conf. --- cmd/server/main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'cmd/server/main.go') diff --git a/cmd/server/main.go b/cmd/server/main.go index d76f938..21f7031 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -34,8 +34,8 @@ func main() { //nolint:funlen indexPath := fl.String("i", defaultIndexPath, "Path in which, when called will rebuild the index and clear the cache") - redisAddr := fl.String("r", "127.0.0.1:6379", - "Redis server set to \"\" to disable") + redisAddr := fl.String("r", "127.0.0.1:6379", "Redis server set to \"\" to disable") + redisKey := fl.String("rk", "go-website", "Redis key to use for storing cached pages") pageTimeout := fl.Int("timeout", 15, "Seconds until page timeout for read and write") @@ -63,6 +63,10 @@ func main() { //nolint:funlen app.ReIndexPath = *indexPath } + if app.RedisKey == "" { + app.RedisKey = *redisKey + } + if *redisAddr != "" { app.redisPool = &redis.Pool{ MaxIdle: 80, //nolint:gomnd -- cgit v1.2.3