lib/cached_resource/caching.rb in cached_resource-4.0.0 vs lib/cached_resource/caching.rb in cached_resource-4.1.0
- old
+ new
@@ -83,10 +83,12 @@
# Read a entry from the cache for the given key.
def cache_read(key)
object = cached_resource.cache.read(key).try do |cache|
if cache.is_a? Enumerable
- cache.map { |record| full_dup(record) }
+ restored = cache.map { |record| full_dup(record) }
+ next restored unless respond_to?(:collection_parser)
+ collection_parser.new(restored)
else
full_dup(cache)
end
end
object && cached_resource.logger.info("#{CachedResource::Configuration::LOGGER_PREFIX} READ #{key}")