Class: ActiveSupport::Cache::Litecache
- Inherits:
-
Store
- Object
- Store
- ActiveSupport::Cache::Litecache
- Includes:
- Strategy::LocalCache
- Defined in:
- lib/active_support/cache/litecache.rb
Class Method Summary collapse
Instance Method Summary collapse
- #cleanup(limit = nil, time = nil) ⇒ Object
- #clear ⇒ Object
- #count ⇒ Object
- #decrement(key, amount = 1, options = nil) ⇒ Object
- #increment(key, amount = 1, options = nil) ⇒ Object
-
#initialize(options = {}) ⇒ Litecache
constructor
A new instance of Litecache.
- #max_size ⇒ Object
- #prune(limit = nil, time = nil) ⇒ Object
- #size ⇒ Object
- #stats ⇒ Object
Constructor Details
Class Method Details
.supports_cache_versioning? ⇒ Boolean
13 14 15 |
# File 'lib/active_support/cache/litecache.rb', line 13 def self.supports_cache_versioning? true end |
Instance Method Details
#cleanup(limit = nil, time = nil) ⇒ Object
45 46 47 |
# File 'lib/active_support/cache/litecache.rb', line 45 def cleanup(limit = nil, time = nil) @cache.prune(limit) end |
#clear ⇒ Object
49 50 51 |
# File 'lib/active_support/cache/litecache.rb', line 49 def clear @cache.clear end |
#count ⇒ Object
53 54 55 |
# File 'lib/active_support/cache/litecache.rb', line 53 def count @cache.count end |
#decrement(key, amount = 1, options = nil) ⇒ Object
36 37 38 39 |
# File 'lib/active_support/cache/litecache.rb', line 36 def decrement(key, amount = 1, = nil) = () increment(key, -1 * amount, [:expires_in]) end |
#increment(key, amount = 1, options = nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/active_support/cache/litecache.rb', line 23 def increment(key, amount = 1, = nil) key = key.to_s = () # todo: fix me # this is currently a hack to avoid dealing with Rails cache encoding and decoding # @cache.transaction(:immediate) do if (value = read(key, )) value = value.to_i + amount write(key, value, ) end # end end |
#max_size ⇒ Object
61 62 63 |
# File 'lib/active_support/cache/litecache.rb', line 61 def max_size @cache.max_size end |
#prune(limit = nil, time = nil) ⇒ Object
41 42 43 |
# File 'lib/active_support/cache/litecache.rb', line 41 def prune(limit = nil, time = nil) @cache.prune(limit) end |
#size ⇒ Object
57 58 59 |
# File 'lib/active_support/cache/litecache.rb', line 57 def size @cache.size end |
#stats ⇒ Object
65 66 67 |
# File 'lib/active_support/cache/litecache.rb', line 65 def stats @cache.stats end |