Sha256: a6294f31686baf4b7a2a60b3bcb22e34b3902abcf756953646ee6c4c0b1f59ac

Contents?: true

Size: 1.43 KB

Versions: 60

Compression:

Stored size: 1.43 KB

Contents

module ActiveSupport
  module Cache
    # A cache store implementation which stores everything into memory in the
    # same process. If you're running multiple Ruby on Rails server processes
    # (which is the case if you're using mongrel_cluster or Phusion Passenger),
    # then this means that your Rails server process instances won't be able
    # to share cache data with each other. If your application never performs
    # manual cache item expiry (e.g. when you're using generational cache keys),
    # then using MemoryStore is ok. Otherwise, consider carefully whether you
    # should be using this cache store.
    #
    # MemoryStore is not only able to store strings, but also arbitrary Ruby
    # objects.
    #
    # MemoryStore is not thread-safe. Use SynchronizedMemoryStore instead
    # if you need thread-safety.
    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.freeze
      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

      def exist?(name,options = nil)
        super
        @data.has_key?(name)
      end

      def clear
        @data.clear
      end
    end
  end
end

Version data entries

60 entries across 57 versions & 17 rubygems

Version Path
nbudin-castronaut-0.7.5 vendor/activesupport/lib/active_support/cache/memory_store.rb
radiant-0.8.2 vendor/rails/activesupport/lib/active_support/cache/memory_store.rb
radiant-0.9.0.rc2 vendor/rails/activesupport/lib/active_support/cache/memory_store.rb
webroar-0.3.1 src/admin_panel/vendor/rails/activesupport/lib/active_support/cache/memory_store.rb
webroar-0.3.0 src/admin_panel/vendor/rails/activesupport/lib/active_support/cache/memory_store.rb
usher-0.7.0 spec/rails2_2/vendor/rails/vendor/rails/activesupport/pkg/activesupport-2.2.2/lib/active_support/cache/memory_store.rb
usher-0.7.0 spec/rails2_3/vendor/rails/vendor/rails/activesupport/pkg/activesupport-2.3.3/lib/active_support/cache/memory_store.rb
usher-0.7.0 spec/rails2_3/vendor/rails/vendor/rails/activesupport/lib/active_support/cache/memory_store.rb
usher-0.7.0 spec/rails2_2/vendor/rails/vendor/rails/activesupport/lib/active_support/cache/memory_store.rb
activesupport-2.3.6.pre lib/active_support/cache/memory_store.rb
simply_stated-0.0.5 vendor/gems/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/cache/memory_store.rb
simply_stated-0.0.4 vendor/gems/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/cache/memory_store.rb
esod-client-0.2.1 lib/activesupport-2.2.2/lib/active_support/cache/memory_store.rb
esod-client-0.2.0 lib/activesupport-2.2.2/lib/active_support/cache/memory_store.rb
esod-client-0.1.1 lib/activesupport-2.2.2/lib/active_support/cache/memory_store.rb
esod-client-0.1.0 lib/activesupport-2.2.2/lib/active_support/cache/memory_store.rb
factorylabs-castronaut-0.7.5 vendor/activesupport/lib/active_support/cache/memory_store.rb
ginst-2009.12.8 vendor/rails/activesupport/lib/active_support/cache/memory_store.rb
activesupport-2.3.5 lib/active_support/cache/memory_store.rb
ginst-2009.11.24 vendor/rails/activesupport/lib/active_support/cache/memory_store.rb