Commit 91226c8bc828c21cc28fb65b21f6c218ddf869bc
Committed by
Antonio Terceiro
1 parent
ef9e7758
Exists in
master
and in
29 other branches
ActionItem1163: fragment.to_time for timeouts and is expired if theres only the timout fragment
Showing
1 changed file
with
3 additions
and
1 deletions
Show diff stats
vendor/plugins/timed_cached_fragment/lib/timed_cache_fragment.rb
| ... | ... | @@ -20,6 +20,7 @@ module ActionController |
| 20 | 20 | #checks to see if a cache has fully expired |
| 21 | 21 | def is_cache_expired?(name, is_key = false) |
| 22 | 22 | key = is_key ? name : fragment_cache_key(name) |
| 23 | + return true unless read_fragment(key) | |
| 23 | 24 | timeout = get_timeout(key) |
| 24 | 25 | return (!timeout) || (timeout < Time.now) |
| 25 | 26 | end |
| ... | ... | @@ -43,7 +44,8 @@ module ActionController |
| 43 | 44 | expire_fragment('timeout:' + key) |
| 44 | 45 | end |
| 45 | 46 | def get_timeout(key) |
| 46 | - read_fragment('timeout:' + key) | |
| 47 | + frag = read_fragment('timeout:' + key) | |
| 48 | + frag ? frag.to_time : nil | |
| 47 | 49 | end |
| 48 | 50 | def set_timeout(key, value) |
| 49 | 51 | write_fragment('timeout:' + key, value) | ... | ... |