Sha256: 3df76bc6162f72e3c1defd5c7bf71e6a0bd5737cf0be7a59c9407437af1cb8b0

Contents?: true

Size: 477 Bytes

Versions: 1

Compression:

Stored size: 477 Bytes

Contents

class Zemanta
  class Fetcher
    class Cache
      def initialize(opts = {})
        @key = Key.new(opts).to_s
      end

      def fetch
        fetch_from_storage(@key).to_s
      end

      def save(response)
        storage[@key] = Response.new(response) unless storage[@key]
      end

      private

      def storage
        Zemanta.config.cache_storage
      end

      def fetch_from_storage(opts)
        storage[@key] || NullResponse.new
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zemanta_client-0.0.2 lib/zemanta/fetcher/cache.rb