Module: SolidCache::Store::Api
- Included in:
- SolidCache::Store
- Defined in:
- lib/solid_cache/store/api.rb
Constant Summary collapse
- DEFAULT_MAX_KEY_BYTESIZE =
1024
- SQL_WILDCARD_CHARS =
[ "_", "%" ]
Instance Attribute Summary collapse
-
#max_key_bytesize ⇒ Object
readonly
Returns the value of attribute max_key_bytesize.
Instance Method Summary collapse
- #cleanup(options = nil) ⇒ Object
- #clear(options = nil) ⇒ Object
- #decrement(name, amount = 1, options = nil) ⇒ Object
- #increment(name, amount = 1, options = nil) ⇒ Object
- #initialize(options = {}) ⇒ Object
Instance Attribute Details
#max_key_bytesize ⇒ Object (readonly)
Returns the value of attribute max_key_bytesize.
9 10 11 |
# File 'lib/solid_cache/store/api.rb', line 9 def max_key_bytesize @max_key_bytesize end |
Instance Method Details
#cleanup(options = nil) ⇒ Object
35 36 37 |
# File 'lib/solid_cache/store/api.rb', line 35 def cleanup( = nil) raise NotImplementedError.new("#{self.class.name} does not support cleanup") end |
#clear(options = nil) ⇒ Object
39 40 41 |
# File 'lib/solid_cache/store/api.rb', line 39 def clear( = nil) entry_clear end |
#decrement(name, amount = 1, options = nil) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/solid_cache/store/api.rb', line 26 def decrement(name, amount = 1, = nil) = () key = normalize_key(name, ) instrument :decrement, key, amount: amount do adjust(name, -amount, ) end end |
#increment(name, amount = 1, options = nil) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/solid_cache/store/api.rb', line 17 def increment(name, amount = 1, = nil) = () key = normalize_key(name, ) instrument :increment, key, amount: amount do adjust(name, amount, ) end end |
#initialize(options = {}) ⇒ Object
11 12 13 14 15 |
# File 'lib/solid_cache/store/api.rb', line 11 def initialize( = {}) super() @max_key_bytesize = .fetch(:max_key_bytesize, DEFAULT_MAX_KEY_BYTESIZE) end |