Sha256: 8fced05b30542367336079fd22449a9523fb2cd3b522ac60fd7f7b9436484bff

Contents?: true

Size: 478 Bytes

Versions: 7

Compression:

Stored size: 478 Bytes

Contents

module 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

7 entries across 7 versions & 1 rubygems

Version Path
zemanta_client-0.0.9 lib/zemanta/fetcher/cache.rb
zemanta_client-0.0.8 lib/zemanta/fetcher/cache.rb
zemanta_client-0.0.7 lib/zemanta/fetcher/cache.rb
zemanta_client-0.0.6 lib/zemanta/fetcher/cache.rb
zemanta_client-0.0.5 lib/zemanta/fetcher/cache.rb
zemanta_client-0.0.4 lib/zemanta/fetcher/cache.rb
zemanta_client-0.0.3 lib/zemanta/fetcher/cache.rb