diff options
| author | Nikolaus Gotsche <n@softwarefools.com> | 2017-10-09 01:26:35 +0200 |
|---|---|---|
| committer | Nikolaus Gotsche <n@softwarefools.com> | 2017-10-09 01:26:35 +0200 |
| commit | 23555819c35b6ebea70460ad4695ada3ea92afea (patch) | |
| tree | ba940708418a11ff78576410ebd4b9dde70450be /redigo.go | |
| parent | b4d150602df5b9a61a3d3b1084524c9317c55cde (diff) | |
Diffstat (limited to 'redigo.go')
| -rw-r--r-- | redigo.go | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -23,10 +23,14 @@ func init() { //client.FlushDB() } -func getRed(key string) string { +func delRed(key string) error { + return client.Dump(key).Err() +} + +func getRed(key string) interface{} { val, err := client.Get(key).Result() if err == redis.Nil { - return "nil" + return nil } else if err != nil { panic(err) return err.Error() @@ -35,7 +39,7 @@ func getRed(key string) string { } } -func setRed(key string , val string, dur int) bool { +func setRed(key string , val interface{}, dur int) bool { err := client.Set(key, val,time.Duration(dur)*time.Second).Err() if err != nil { panic(err) |
