go-redis/cache

why not support ttl = -1

Closed this issue · 2 comments

I found I can set ttl = -1 in go-redis, but in cache when ttl < 0 it will be set to 0 by following code in Item.ttl():

if item.TTL < 0 {
    return 0
}

and because of this can't set some special cache permanently

This library assumes that you always want some expiration time for cached items. I think it is a fine assumption in most cases and we should not change it.

I encourage everyone to fork this library to make changes they need. That is what I do regularly as well.

This library assumes that you always want some expiration time for cached items. I think it is a fine assumption in most cases and we should not change it.

I encourage everyone to fork this library to make changes they need. That is what I do regularly as well.

Interfering with the user's decision is not a good library behavior, please remove this artificial restriction!