Sha256: 3adbab8e4371102991d2d63ec94644547c3a55551d64b2b2a83b86b256a73b1b

Contents?: true

Size: 583 Bytes

Versions: 4

Compression:

Stored size: 583 Bytes

Contents

module CanTango
  module Cache
    class HashCache
      include Singleton

      attr_reader :options

      def configure_with options = {}
        @options ||= options
      end

      def load! key
        raise "no key" if key.nil?
        cache[key]
      end

      def save! key, rules
        raise "no key" if key.nil?
        cache[key] = rules
      end

      def delete key
        raise "no key" if key.nil?
        cache[key].delete if cache[key]
      end

      def cache
        @cache ||= {}
      end

      def type
        :memory
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cantango-0.9.4.7 lib/cantango/cache/hash_cache.rb
cantango-0.9.4.6 lib/cantango/cache/hash_cache.rb
cantango-0.9.4.5 lib/cantango/cache/hash_cache.rb
cantango-0.9.4.3 lib/cantango/cache/hash_cache.rb