Sha256: ca42e6442e2c423d1b2388b12a87dd85992d0c53f531171ff071f3658f9e92e5
Contents?: true
Size: 725 Bytes
Versions: 3
Compression:
Stored size: 725 Bytes
Contents
module FastSerializer # Base class for cache implementations for storing cacheable serializers. # Implementations must implement the +fetch+ method. class Cache def fetch(serializer, ttl, &block) raise NotImplementedError end # Fetch multiple serializers from the cache. The default behavior is just # to call +fetch+ with each serializer. Implementations may optimize this # if the cache can return multiple values at once. # # The block to this method will be yielded to with each uncached serializer. def fetch_all(serializers, ttl) serializers.collect do |serializer| fetch(serializer, ttl) do yield(serializer) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fast_serializer-1.1.1 | lib/fast_serializer/cache.rb |
fast_serializer-1.1.0 | lib/fast_serializer/cache.rb |
fast_serializer-1.0.2 | lib/fast_serializer/cache.rb |