goburrow / cache

Mango Cache 🥭 - Partial implementation of Guava Cache in Go (golang).
BSD 3-Clause "New" or "Revised" License
580 stars 48 forks source link

the load can not bring the oldValue to the func callback #25

Closed yiting1122 closed 3 years ago

yiting1122 commented 3 years ago

image

i want to write an expire refresh strategy, but i need the old value

nqv commented 3 years ago

Right, it needs support for user-defined refresh function. I'll see if I can add it.

nqv commented 3 years ago

I have added Reloader, would you please try cache.WithReloader(...) and let me know if it works for you.

go get github.com/goburrow/cache@f6da914dd6e3546dffa8802919dbca80cd33abe3

Note that you'll need to compute and call setter callback asynchronously, i.e in a go routine. Thanks

yiting1122 commented 3 years ago

ok, i will have a try, i have read the source code。 And i have another question, may i use this cache in my product to provide service for some users, it's stable? Thanks very much

yiting1122 commented 3 years ago

it's works for me ,i have make a test. The important this is the above question, it is stable fro product?

Thanks

nqv commented 3 years ago

I'm using this for my personal projects, but can't guarantee. See https://github.com/goburrow/cache/blob/master/LICENSE

yiting1122 commented 3 years ago

ok, i will test fully.

if i have some questions, i will submit comments here.

Thanks