Redis: Set without expiration

Created on 5 Aug 2015  路  3Comments  路  Source: go-redis/redis

For this function:

func (c *Client) Set(key string, value interface{}, expiration time.Duration) *StatusCmd

Is there a way to set without having an expiration time as a really far time from now? Will nil work?

Most helpful comment

expiration=0 means no expiration. So if you don't want key to expire use:

cl.Set("key", "value", 0)

All 3 comments

expiration=0 means no expiration. So if you don't want key to expire use:

cl.Set("key", "value", 0)

Thank you. I couldn't find that anywhere in the docs.

Fair point. Tried to address with https://github.com/go-redis/redis/pull/144

Was this page helpful?
0 / 5 - 0 ratings