diff options
Diffstat (limited to 'rediscache/main.go')
| -rw-r--r-- | rediscache/main.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/rediscache/main.go b/rediscache/main.go index e7564c8..7ae3d4d 100644 --- a/rediscache/main.go +++ b/rediscache/main.go @@ -57,13 +57,13 @@ func (rw *redisHTTPResponseWriter) WriteData() { // Simple function that will cache the response for given handler in redis // and instead of responding with the result from the handler it will // simply dump the contents of the redis key if it exists. -func Handle(pool *redis.Pool, next http.Handler) http.Handler { +func Handle(pool *redis.Pool, key string, next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { client := pool.Get() defer client.Close() content: - data, err := client.Do("GET", r.URL.Path) + data, err := client.Do("HGET", key, r.URL.Path) if err != nil { // Assume something bad has happened with redis, we're // just going to log this and then pass through the @@ -83,7 +83,7 @@ func Handle(pool *redis.Pool, next http.Handler) http.Handler { return } - _, err = client.Do("SET", r.URL.Path, b) + _, err = client.Do("HSET", key, r.URL.Path, b) if err != nil { Logger.Println("ERROR: during set: ", err) |
