go-redis/cache

why doesnot item.Get() execute item.Do() when cacheMiss?

JellyZhang opened this issue · 3 comments

In my point of view, item.Do()returns the up-to-date value of item everytime when it is called.
so I think maybe we can get the up-to-date value whenitem.Get()miss cache , and put it into redis/lru with expiration time of TTL.

There is no such thing as item.Get. But Cache.Once works in a similar way.

There is no such thing as item.Get. But Cache.Once works in a similar way.

yeap, my mistake, I meant Cache.Get().
So why does not Cache.Get refresh the value of item using item.Do?

@JellyZhang I think you are mistaken - the API looks/works differently.