Froze rails gems
[depot.git] / vendor / rails / activesupport / lib / active_support / cache / synchronized_memory_store.rb
1 module ActiveSupport
2 module Cache
3 # Like MemoryStore, but thread-safe.
4 class SynchronizedMemoryStore < MemoryStore
5 def initialize
6 super
7 @guard = Monitor.new
8 end
9
10 def fetch(key, options = {})
11 @guard.synchronize { super }
12 end
13
14 def read(name, options = nil)
15 @guard.synchronize { super }
16 end
17
18 def write(name, value, options = nil)
19 @guard.synchronize { super }
20 end
21
22 def delete(name, options = nil)
23 @guard.synchronize { super }
24 end
25
26 def delete_matched(matcher, options = nil)
27 @guard.synchronize { super }
28 end
29
30 def exist?(name,options = nil)
31 @guard.synchronize { super }
32 end
33
34 def increment(key, amount = 1)
35 @guard.synchronize { super }
36 end
37
38 def decrement(key, amount = 1)
39 @guard.synchronize { super }
40 end
41
42 def clear
43 @guard.synchronize { super }
44 end
45 end
46 end
47 end