Sha256: ed75d544433b4b9d8b7e6ba3f38512645d7f65c331ae0b1908810450e24a66c4

Contents?: true

Size: 673 Bytes

Versions: 1

Compression:

Stored size: 673 Bytes

Contents

module MarketoApi
  module Concerns
    module Caching
      # Public: Runs the block with caching disabled.
      #
      # block - A query/describe/etc.
      #
      # Returns the result of the block
      def without_caching(&block)
        options[:use_cache] = false
        block.call
      ensure
        options.delete(:use_cache)
      end

      private

      # Internal: Cache to use for the caching middleware
      def cache
        options[:cache]
      end

      def options_with_custom_strategy
        {
          :strategy => MarketoApi::Middleware::CachingStrategy,
          :store => cache,
          **options
        }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
marketo_api-0.3.0.pre.alpha lib/marketo_api/concerns/caching.rb