Class: AnyCache::Adapters::RedisStore Private
- Defined in:
- lib/any_cache/adapters/redis_store.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary
Constants inherited from Redis
AnyCache::Adapters::Redis::DEAD_TTL, AnyCache::Adapters::Redis::DEFAULT_INCR_DECR_AMOUNT, AnyCache::Adapters::Redis::DELETE_MATCHED_BATCH_SIZE, AnyCache::Adapters::Redis::DELETE_MATCHED_CURSOR_START, AnyCache::Adapters::Redis::NO_EXPIRATION_TTL
Instance Attribute Summary
Attributes inherited from Basic
Class Method Summary collapse
Instance Method Summary collapse
- #read(key, **options) ⇒ Object private
- #read_multi(*keys, **options) ⇒ Hash private
- #write(key, value, **options) ⇒ void private
- #write_multi(entries, **options) ⇒ void private
Methods inherited from Redis
#cleanup, #clear, #decrement, #delete, #delete_matched, #exist?, #expire, #fetch, #fetch_multi, #increment, #persist
Methods inherited from Basic
#cleanup, #clear, #decrement, #delete, #delete_matched, #exist?, #expire, #fetch, #fetch_multi, #increment, #initialize, #persist
Methods included from Dumper::InterfaceAccessMixin
#detransform_pairset, #detransform_value, #transform_pairset, #transform_value
Constructor Details
This class inherits a constructor from AnyCache::Adapters::Basic
Class Method Details
.supported_driver?(driver) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
13 14 15 |
# File 'lib/any_cache/adapters/redis_store.rb', line 13 def supported_driver?(driver) AnyCache::Drivers::RedisStore.supported_source?(driver) end |
Instance Method Details
#read(key, **options) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 29 30 31 |
# File 'lib/any_cache/adapters/redis_store.rb', line 26 def read(key, **) raw = .fetch(:raw, false) value = get(key, raw: true) raw ? value : detransform_value(value) end |
#read_multi(*keys, **options) ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 42 |
# File 'lib/any_cache/adapters/redis_store.rb', line 39 def read_multi(*keys, **) # NOTE: cant use Redis::Store#mget cuz it has some marshalling errors :( Hash[keys.zip(keys.map { |key| read(key, **) })] end |
#write(key, value, **options) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
52 53 54 55 56 57 58 |
# File 'lib/any_cache/adapters/redis_store.rb', line 52 def write(key, value, **) expires_in = .fetch(:expires_in, NO_EXPIRATION_TTL) raw = .fetch(:raw, false) value = transform_value(value) unless raw expires_in ? setex(key, expires_in, value, raw: true) : set(key, value, raw: true) end |
#write_multi(entries, **options) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
66 67 68 69 70 71 |
# File 'lib/any_cache/adapters/redis_store.rb', line 66 def write_multi(entries, **) raw = .fetch(:raw, false) entries = transform_pairset(entries) unless raw mset(*entries.to_a.flatten!, raw: true) end |