Sha256: 3ff751111a7fc5f535648f298db2063e92580b131d294c9a207085f09fd4687b

Contents?: true

Size: 624 Bytes

Versions: 16

Compression:

Stored size: 624 Bytes

Contents

require_relative 'base'

module Zipcoder
  module Cacher
    class Memory < Base
      def _init_cache(**kwargs)
        @cache = {}
      end

      def _empty_cache
        @cache.clear
      end

      def _write_cache(key, value)
        @cache[key] = value
      end

      def _read_cache(key)
        @cache[key]
      end

      def _iterate_keys(**kwargs, &block)
        return if block == nil

        start_with = kwargs[:start_with]

        @cache.keys.each do |key|
          if start_with == nil or key.start_with?(start_with)
            block.call(key)
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
zipcoder-0.9.2 lib/zipcoder/cacher/memory.rb
zipcoder-0.9.1 lib/zipcoder/cacher/memory.rb
zipcoder-0.9.0 lib/zipcoder/cacher/memory.rb
zipcoder-0.8.4 lib/zipcoder/cacher/memory.rb
zipcoder-0.8.3 lib/zipcoder/cacher/memory.rb
zipcoder-0.8.2 lib/zipcoder/cacher/memory.rb
zipcoder-0.8.1 lib/zipcoder/cacher/memory.rb
zipcoder-0.8.0 lib/zipcoder/cacher/memory.rb
zipcoder-0.7.4 lib/zipcoder/cacher/memory.rb
zipcoder-0.7.3 lib/zipcoder/cacher/memory.rb
zipcoder-0.7.2 lib/zipcoder/cacher/memory.rb
zipcoder-0.7.1 lib/zipcoder/cacher/memory.rb
zipcoder-0.7.0 lib/zipcoder/cacher/memory.rb
zipcoder-0.6.1 lib/zipcoder/cacher/memory.rb
zipcoder-0.6.0 lib/zipcoder/cacher/memory.rb
zipcoder-0.5.0 lib/zipcoder/cacher/memory.rb