diff --git a/lib/aws/s3/acl.rb b/lib/aws/s3/acl.rb index 334e6e9..b780aaf 100644 --- a/lib/aws/s3/acl.rb +++ b/lib/aws/s3/acl.rb @@ -528,7 +528,7 @@ module AWS # bucket.acl(bucket.acl) def acl(reload = false) policy = reload.is_a?(ACL::Policy) ? reload : nil - memoize(reload) do + expirable_memoize(reload) do self.class.acl(name, policy) if policy self.class.acl(name) end @@ -579,7 +579,7 @@ module AWS # object.acl(object.acl) def acl(reload = false) policy = reload.is_a?(ACL::Policy) ? reload : nil - memoize(reload) do + expirable_memoize(reload) do self.class.acl(key, bucket.name, policy) if policy self.class.acl(key, bucket.name) end diff --git a/lib/aws/s3/extensions.rb b/lib/aws/s3/extensions.rb index 6a9bc75..312d90e 100644 --- a/lib/aws/s3/extensions.rb +++ b/lib/aws/s3/extensions.rb @@ -133,7 +133,7 @@ module Kernel caller[1][/`([^']+)'/, 1] end if RUBY_VERSION > '1.8.7' - def memoize(reload = false, storage = nil) + def expirable_memoize(reload = false, storage = nil) current_method = RUBY_VERSION >= '1.8.7' ? __called_from__ : __method__(1) storage = "@#{storage || current_method}" if reload @@ -174,7 +174,7 @@ class Module alias_method original_method, method_name module_eval(<<-EVAL, __FILE__, __LINE__) def #{method_name}(reload = false, *args, &block) - memoize(reload) do + expirable_memoize(reload) do send(:#{original_method}, *args, &block) end end diff --git a/lib/aws/s3/object.rb b/lib/aws/s3/object.rb index 77a60df..bcdf9e1 100644 --- a/lib/aws/s3/object.rb +++ b/lib/aws/s3/object.rb @@ -485,7 +485,7 @@ module AWS reload = options options = {} end - memoize(reload) do + expirable_memoize(reload) do self.class.stream(key, bucket.name, options, &block) end end @@ -561,7 +561,7 @@ module AWS def etag(reload = false) return nil unless stored? - memoize(reload) do + expirable_memoize(reload) do reload ? about(reload)['etag'][1...-1] : attributes['e_tag'][1...-1] end end diff --git a/lib/aws/s3/version.rb b/lib/aws/s3/version.rb index e112659..3f8f703 100644 --- a/lib/aws/s3/version.rb +++ b/lib/aws/s3/version.rb @@ -4,7 +4,7 @@ module AWS MAJOR = '0' MINOR = '6' TINY = '0' - BETA = nil # Time.now.to_i.to_s + BETA = Time.now.to_i.to_s end Version = [VERSION::MAJOR, VERSION::MINOR, VERSION::TINY, VERSION::BETA].compact * '.' diff --git a/test/extensions_test.rb b/test/extensions_test.rb index 846d76e..8bbe100 100644 --- a/test/extensions_test.rb +++ b/test/extensions_test.rb @@ -144,13 +144,13 @@ end if RUBY_VERSION < '1.8.7' class ModuleExtensionsTest < Test::Unit::TestCase class Foo def foo(reload = false) - memoize(reload) do + expirable_memoize(reload) do Time.now end end def bar(reload = false) - memoize(reload, :baz) do + expirable_memoize(reload, :baz) do Time.now end end