From 91226c8bc828c21cc28fb65b21f6c218ddf869bc Mon Sep 17 00:00:00 2001 From: Moises Machado Date: Fri, 31 Jul 2009 17:15:16 -0300 Subject: [PATCH] ActionItem1163: fragment.to_time for timeouts and is expired if theres only the timout fragment --- vendor/plugins/timed_cached_fragment/lib/timed_cache_fragment.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vendor/plugins/timed_cached_fragment/lib/timed_cache_fragment.rb b/vendor/plugins/timed_cached_fragment/lib/timed_cache_fragment.rb index a93307b..2ce6430 100644 --- a/vendor/plugins/timed_cached_fragment/lib/timed_cache_fragment.rb +++ b/vendor/plugins/timed_cached_fragment/lib/timed_cache_fragment.rb @@ -20,6 +20,7 @@ module ActionController #checks to see if a cache has fully expired def is_cache_expired?(name, is_key = false) key = is_key ? name : fragment_cache_key(name) + return true unless read_fragment(key) timeout = get_timeout(key) return (!timeout) || (timeout < Time.now) end @@ -43,7 +44,8 @@ module ActionController expire_fragment('timeout:' + key) end def get_timeout(key) - read_fragment('timeout:' + key) + frag = read_fragment('timeout:' + key) + frag ? frag.to_time : nil end def set_timeout(key, value) write_fragment('timeout:' + key, value) -- libgit2 0.21.2