Permalink
Browse files

don't let epochs expire. also increase default ttl.

  • Loading branch information...
1 parent 94bfb6d commit 6191e4794159cc995c02e038e06a8dedc29b0a9c @seamusabshere committed Feb 22, 2011
Showing with 6 additions and 5 deletions.
  1. +1 −1 lib/cache_method.rb
  2. +2 −2 lib/cache_method/config.rb
  3. +2 −1 lib/cache_method/epoch.rb
  4. +1 −1 lib/cache_method/version.rb
View
@@ -40,7 +40,7 @@ module ClassMethods
#
# Note: Remember to define <tt>#hash</tt> on any object whose instance methods might get cached.
#
- # Note 2: Check out CacheMethod.config.default_ttl... the default is only 60 seconds.
+ # Note 2: Check out CacheMethod.config.default_ttl... the default is 24 hours.
#
# Example:
# class Blog
@@ -33,7 +33,7 @@ def storage #:nodoc:
@storage || raise("You need to set CacheMethod.config.storage with a cache storage of your choice")
end
- # TTL for method caches. Defaults to 60 seconds.
+ # TTL for method caches. Defaults to 24 hours or 86,400 seconds.
#
# Example:
# CacheMethod.config.default_ttl = 120 # seconds
@@ -42,7 +42,7 @@ def default_ttl=(seconds)
end
def default_ttl #:nodoc:
- @default_ttl || 60
+ @default_ttl || 86_400
end
end
end
@@ -46,7 +46,8 @@ def current
cached_v
else
v = Epoch.random_name
- Config.instance.storage.set cache_key, v
+ # never expire!
+ Config.instance.storage.set cache_key, v, 0
v
end
end
@@ -1,3 +1,3 @@
module CacheMethod
- VERSION = "0.1.0"
+ VERSION = "0.1.1"
end

0 comments on commit 6191e47

Please sign in to comment.