Class: ActiveSupport::Cache::SynchronizedMemoryStore

Inherits:
MemoryStore show all
Defined in:
lib/active_support/cache/synchronized_memory_store.rb

Overview

Like MemoryStore, but thread-safe.

Instance Method Summary collapse

Methods inherited from Store

#silence!

Constructor Details

#initializeSynchronizedMemoryStore

Returns a new instance of SynchronizedMemoryStore.



5
6
7
8
# File 'lib/active_support/cache/synchronized_memory_store.rb', line 5

def initialize
  super
  @guard = Monitor.new
end

Instance Method Details

#clearObject



42
43
44
# File 'lib/active_support/cache/synchronized_memory_store.rb', line 42

def clear
  @guard.synchronize { super }
end

#decrement(key, amount = 1) ⇒ Object



38
39
40
# File 'lib/active_support/cache/synchronized_memory_store.rb', line 38

def decrement(key, amount = 1)
  @guard.synchronize { super }
end

#delete(name, options = nil) ⇒ Object



22
23
24
# File 'lib/active_support/cache/synchronized_memory_store.rb', line 22

def delete(name, options = nil)
  @guard.synchronize { super }
end

#delete_matched(matcher, options = nil) ⇒ Object



26
27
28
# File 'lib/active_support/cache/synchronized_memory_store.rb', line 26

def delete_matched(matcher, options = nil)
  @guard.synchronize { super }
end

#exist?(name, options = nil) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/active_support/cache/synchronized_memory_store.rb', line 30

def exist?(name,options = nil)
  @guard.synchronize { super }
end

#fetch(key, options = {}) ⇒ Object



10
11
12
# File 'lib/active_support/cache/synchronized_memory_store.rb', line 10

def fetch(key, options = {})
  @guard.synchronize { super }
end

#increment(key, amount = 1) ⇒ Object



34
35
36
# File 'lib/active_support/cache/synchronized_memory_store.rb', line 34

def increment(key, amount = 1)
  @guard.synchronize { super }
end

#read(name, options = nil) ⇒ Object



14
15
16
# File 'lib/active_support/cache/synchronized_memory_store.rb', line 14

def read(name, options = nil)
  @guard.synchronize { super }
end

#write(name, value, options = nil) ⇒ Object



18
19
20
# File 'lib/active_support/cache/synchronized_memory_store.rb', line 18

def write(name, value, options = nil)
  @guard.synchronize { super }
end