lib/mrcr/cache.rb in mrcr-cache-0.1.3 vs lib/mrcr/cache.rb in mrcr-cache-0.1.4

- old
+ new

@@ -48,21 +48,18 @@ # @return [Object] block's return value (cached for subsequent calls with the same argument values) def fetch_or_store(key, &block) cache.fetch_or_store(key.hash, &block) end - # Caches a result of the block evaluation + # Fetch a cache by key & default # # @param [Object] key Hashable object # @param [Object] default Default value - # @yield An arbitrary block # - # @note beware Proc instance hashes are not equal, i.e. -> { 1 }.hash != -> { 1 }.hash, - # this means you shouldn't pass Procs in args unless you're sure - # they are always the same instances, otherwise you introduce a memory leak + # @note (see #fetch_or_store) # - # @return [Object] block's return value (cached for subsequent calls with the same argument values) + # @return [Object] return value or default def fetch(key, default = nil) cache.fetch(key.hash, default) end # Instance methods @@ -79,12 +76,11 @@ # Delegates call to the class-level method # # @param [Object] key Hashable object # @param [Object] default Default value. - # @yield An arbitrary block # - # @return [Object] block's return value + # @return [Object] return value or default def fetch(key, default = nil) self.class.fetch(key, default) end end end