Sha256: 8a7f57af7c063c27bfa46b8f8b9215aa962514118a147258eec0822da51ffe52

Contents?: true

Size: 504 Bytes

Versions: 8

Compression:

Stored size: 504 Bytes

Contents

require_relative 'base'

module Drydock
  module ObjectCaches
    class NoCache < Base

      def clear
        true
      end

      def fetch(key, &blk)
        blk.call
      end

      def get(key, &blk)
        nil
      end

      def key?(key)
        false
      end

      def set(key, value = nil, &blk)
        if blk
          File.open('/dev/null', 'w') do |file|
            blk.call file
          end
        else
          # :noop:
        end

        nil
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dry-dock-0.2.0 lib/drydock/object_caches/no_cache.rb
dry-dock-0.1.6 lib/drydock/object_caches/no_cache.rb
dry-dock-0.1.5 lib/drydock/object_caches/no_cache.rb
dry-dock-0.1.4 lib/drydock/object_caches/no_cache.rb
dry-dock-0.1.3 lib/drydock/object_caches/no_cache.rb
dry-dock-0.1.2 lib/drydock/object_caches/no_cache.rb
dry-dock-0.1.1 lib/drydock/object_caches/no_cache.rb
dry-dock-0.1.0 lib/drydock/object_caches/no_cache.rb