mperham/dalli — pull request #378 by pitr (2013-07-11 05:11:56+00:00)
Title: Support stale cache reads

Implements #286

Here's pseudocode for this feature:

```ruby
is_fresh = read_freshness
entry = read_cache

if is_fresh
entry
if !staleness_check && entry
entry
elsif !entry
entry = call_function
write_cache entry
write_freshness expire_in: options[:stale_after]
entry
else
begin
entry = call_function
write_cache entry
write_freshness expire_in: options[:stale_after]
rescue Exception => e
entry
end
end
```

@mperham what do you think? Also, how would you suggest testing this?