aboutsummaryrefslogblamecommitdiffstats
path: root/activesupport/lib/active_support/cache/memory_store.rb
blob: e0aba6b19a063341a4c0cb9521a15d730d8ee52a (plain) (tree)




























                                                
module ActiveSupport
  module Cache
    class MemoryStore < Store
      def initialize
        @data = {}
      end

      def read(name, options = nil)
        super
        @data[name]
      end

      def write(name, value, options = nil)
        super
        @data[name] = value
      end

      def delete(name, options = nil)
        super
        @data.delete(name)
      end

      def delete_matched(matcher, options = nil)
        super
        @data.delete_if { |k,v| k =~ matcher }
      end
    end
  end
end