Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
431 views
in Technique[技术] by (71.8m points)

Why does Rails cache expiration doesn't work?

I'm trying to setup cache expiration time like this:

Rails.cache.write('trash', items, expires_in: 30.seconds) 

or like this

Rails.cache.read('trash', expires_in: 30.seconds) 

but nothing works in my case. The cache is not deleted/invalidated after the expiration time passes.

question from:https://stackoverflow.com/questions/66066438/why-does-rails-cache-expiration-doesnt-work

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Low-level caching, which you are trying to do here, doesn't work with Memstore (yellow box), the default for development. You'll have to setup something like MemCached or Redis for development.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...