Support stale cache reads #286

Open
mperham opened this Issue Nov 11, 2012 · 3 comments

Projects

None yet

2 participants

@mperham
Collaborator
mperham commented Nov 11, 2012

We have a case where we call a third party service which goes down a lot. I would like to cache the result and serve it if the value cannot be fetched, eg:

dalli.fetch('foo', :stale_after => 1.hour, :expires_in => 12.hours, :error_handler => nil) do
  call_service
end

I'm inclined to make this a new method and not add more logic to fetch.

@mperham
Collaborator
mperham commented Nov 11, 2012

Also, how does this compare with race_condition_ttl?

@pitr
pitr commented Jul 10, 2013

@mperham Are you still interested in this? I think :stale_after is a great idea. Would you accept pull request implementing this?

@mperham
Collaborator
mperham commented Jul 11, 2013

Yeah, it's still relevant (but low priority for our use case) to us. Sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment