Class: RailsFastCache::Store
- Inherits:
-
ActiveSupport::Cache::Store
- Object
- ActiveSupport::Cache::Store
- RailsFastCache::Store
- Defined in:
- lib/rails-fast-cache/store.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(cache_store, *parameters) ⇒ Store
constructor
A new instance of Store.
- #shutdown ⇒ Object
- #write(name, value, options = nil) ⇒ Object
- #write_multi(hash, options = nil) ⇒ Object
Constructor Details
#initialize(cache_store, *parameters) ⇒ Store
Returns a new instance of Store.
45 46 47 48 49 50 51 52 |
# File 'lib/rails-fast-cache/store.rb', line 45 def initialize(cache_store, *parameters) = parameters. [:compressor] ||= RailsFastCache::BrotliCompressor if !.key?(:coder) && cache_store != :memory_store [:serializer] ||= :message_pack unless .key?(:coder) @cache_store = ActiveSupport::Cache.lookup_store(cache_store, *parameters, **) self.class.cache_store = @cache_store end |
Class Method Details
.shutdown ⇒ Object
41 42 43 |
# File 'lib/rails-fast-cache/store.rb', line 41 def self.shutdown RailsFastCache::Scheduler.shutdown end |
.supports_cache_versioning? ⇒ Boolean
37 38 39 |
# File 'lib/rails-fast-cache/store.rb', line 37 def self.supports_cache_versioning? true end |
Instance Method Details
#shutdown ⇒ Object
64 65 66 |
# File 'lib/rails-fast-cache/store.rb', line 64 def shutdown self.class.shutdown end |
#write(name, value, options = nil) ⇒ Object
54 55 56 57 |
# File 'lib/rails-fast-cache/store.rb', line 54 def write(name, value, = nil) WriteJob.perform_later(@cache_store, name, value, ) true end |
#write_multi(hash, options = nil) ⇒ Object
59 60 61 62 |
# File 'lib/rails-fast-cache/store.rb', line 59 def write_multi(hash, = nil) WriteMultiJob.perform_later(@cache_store, hash, ) true end |