aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/cache/memory_store.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/cache/memory_store.rb')
-rw-r--r--activesupport/lib/active_support/cache/memory_store.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/cache/memory_store.rb b/activesupport/lib/active_support/cache/memory_store.rb
new file mode 100644
index 0000000000..e0aba6b19a
--- /dev/null
+++ b/activesupport/lib/active_support/cache/memory_store.rb
@@ -0,0 +1,29 @@
+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 \ No newline at end of file