From ffe1b892b4c01c40215a1b8b5697fc35b81186b5 Mon Sep 17 00:00:00 2001 From: Horus3 Date: Fri, 20 Feb 2015 16:49:27 +0100 Subject: Add caching struct as json in redis. --- app/utilities.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'app/utilities.go') diff --git a/app/utilities.go b/app/utilities.go index 75967b1..5c665e2 100644 --- a/app/utilities.go +++ b/app/utilities.go @@ -3,14 +3,15 @@ package main import ( "crypto/md5" "fmt" - // "github.com/garyburd/redigo/redis" + "github.com/garyburd/redigo/redis" "golang.org/x/crypto/bcrypt" "io" "io/ioutil" "log" "math/rand" "net/http" - // "time" + "os" + "time" ) // Returns headers as map and the content of a webpage as string @@ -49,17 +50,17 @@ func RandomKey() string { return string(key) } -//var pool = newPool() +var pool = newPool() -/* // Creates a pool with connections to Redis func newPool() *redis.Pool { return &redis.Pool{ MaxIdle: 3, IdleTimeout: 240 * time.Second, Dial: func() (redis.Conn, error) { - //c, err := redis.Dial("tcp", ":6379") - c, err := redis.Dial("tcp", revel.Config.StringDefault("redis.server", "127.0.0.1")+":"+revel.Config.StringDefault("redis.port", "6379")) + redis_server := os.Getenv("STATUS_REDIS_SERVER") + redis_port := os.Getenv("STATUS_REDIS_PORT") + c, err := redis.Dial("tcp", redis_server+":"+redis_port) if err != nil { return nil, err } @@ -71,7 +72,6 @@ func newPool() *redis.Pool { }, } } -*/ // Hashs password with bcrypt and returns the string func HashPassword(password string) (string, error) { -- cgit v1.2.3