| Class | ActiveSupport::Cache::Store |
| In: |
vendor/rails/activesupport/lib/active_support/cache.rb
|
| Parent: | Object |
# File vendor/rails/activesupport/lib/active_support/cache.rb, line 105
105: def decrement(key, amount = 1)
106: log("decrementing", key, amount)
107: if num = read(key)
108: write(key, num - amount)
109: else
110: nil
111: end
112: end
# File vendor/rails/activesupport/lib/active_support/cache.rb, line 84
84: def delete(key, options = nil)
85: log("delete", key, options)
86: end
# File vendor/rails/activesupport/lib/active_support/cache.rb, line 88
88: def delete_matched(matcher, options = nil)
89: log("delete matched", matcher.inspect, options)
90: end
# File vendor/rails/activesupport/lib/active_support/cache.rb, line 92
92: def exist?(key, options = nil)
93: log("exist?", key, options)
94: end
Pass :force => true to force a cache miss.
# File vendor/rails/activesupport/lib/active_support/cache.rb, line 53
53: def fetch(key, options = {})
54: @logger_off = true
55: if !options[:force] && value = read(key, options)
56: @logger_off = false
57: log("hit", key, options)
58: value
59: elsif block_given?
60: @logger_off = false
61: log("miss", key, options)
62:
63: value = nil
64: seconds = Benchmark.realtime { value = yield }
65:
66: @logger_off = true
67: write(key, value, options)
68: @logger_off = false
69:
70: log("write (will save #{'%.5f' % seconds})", key, nil)
71:
72: value
73: end
74: end
# File vendor/rails/activesupport/lib/active_support/cache.rb, line 96
96: def increment(key, amount = 1)
97: log("incrementing", key, amount)
98: if num = read(key)
99: write(key, num + amount)
100: else
101: nil
102: end
103: end
# File vendor/rails/activesupport/lib/active_support/cache.rb, line 76
76: def read(key, options = nil)
77: log("read", key, options)
78: end
# File vendor/rails/activesupport/lib/active_support/cache.rb, line 46
46: def threadsafe!
47: @mutex = Mutex.new
48: self.class.send :include, ThreadSafety
49: self
50: end