Methods
Constants
NULL | = | 'remote_cache_store:null' |
this allows caching of the fact that there is nothing in the remote cache |
Public Instance methods
[ show source ]
# File activesupport/lib/active_support/cache/strategy/local_cache.rb, line 89 89: def clear 90: local_cache.clear if local_cache 91: super 92: end
[ show source ]
# File activesupport/lib/active_support/cache/strategy/local_cache.rb, line 80 80: def decrement(key, amount = 1) 81: if value = super 82: local_cache.mute { local_cache.write(key, value.to_s) } if local_cache 83: value 84: else 85: nil 86: end 87: end
[ show source ]
# File activesupport/lib/active_support/cache/strategy/local_cache.rb, line 55 55: def delete(key, options = nil) 56: local_cache.mute { local_cache.write(key, NULL) } if local_cache 57: super 58: end
[ show source ]
# File activesupport/lib/active_support/cache/strategy/local_cache.rb, line 60 60: def exist(key, options = nil) 61: value = local_cache.read(key) if local_cache 62: if value == NULL 63: false 64: elsif value 65: true 66: else 67: super 68: end 69: end
[ show source ]
# File activesupport/lib/active_support/cache/strategy/local_cache.rb, line 71 71: def increment(key, amount = 1) 72: if value = super 73: local_cache.mute { local_cache.write(key, value.to_s) } if local_cache 74: value 75: else 76: nil 77: end 78: end
[ show source ]
# File activesupport/lib/active_support/cache/strategy/local_cache.rb, line 15 15: def middleware 16: @middleware ||= begin 17: klass = Class.new 18: klass.class_eval("def initialize(app)\n@app = app\nend\n\ndef call(env)\nThread.current[:\#{thread_local_key}] = MemoryStore.new\n@app.call(env)\nensure\nThread.current[:\#{thread_local_key}] = nil\nend\n", __FILE__, __LINE__ + 1) 19: klass 20: end 21: end
[ show source ]
# File activesupport/lib/active_support/cache/strategy/local_cache.rb, line 35 35: def read(key, options = nil) 36: value = local_cache && local_cache.read(key) 37: if value == NULL 38: nil 39: elsif value.nil? 40: value = super 41: local_cache.mute { local_cache.write(key, value || NULL) } if local_cache 42: value.duplicable? ? value.dup : value 43: else 44: # forcing the value to be immutable 45: value.duplicable? ? value.dup : value 46: end 47: end
[ show source ]
# File activesupport/lib/active_support/cache/strategy/local_cache.rb, line 8 8: def with_local_cache 9: Thread.current[thread_local_key] = MemoryStore.new 10: yield 11: ensure 12: Thread.current[thread_local_key] = nil 13: end
[ show source ]
# File activesupport/lib/active_support/cache/strategy/local_cache.rb, line 49 49: def write(key, value, options = nil) 50: value = value.to_s if respond_to?(:raw?) && raw?(options) 51: local_cache.mute { local_cache.write(key, value || NULL) } if local_cache 52: super 53: end