Sha256: a314cbaffdfff628874e307d2a5a6b631406421c9fe31fa1aec883d3bdf5af83

Contents?: true

Size: 516 Bytes

Versions: 4

Compression:

Stored size: 516 Bytes

Contents

require 'instagram'
require 'instagram/failsafe_store'

module Instagram
  module Cached
    extend Instagram
    
    class << self
      attr_accessor :cache
      
      def setup(cache_dir, options = {})
        self.cache = FailsafeStore.new(cache_dir, {
          namespace: 'instagram',
          exceptions: [Net::HTTPServerException, JSON::ParserError]
        }.update(options))
      end
      
      private
      def get_url(url)
        cache.fetch(url.to_s) { super }
      end
    end
    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
instagram-0.3.2 lib/instagram/cached.rb
instagram-0.3.1 lib/instagram/cached.rb
instagram-0.3.0 lib/instagram/cached.rb
instagram-0.2.0 lib/instagram/cached.rb