Class: Cashier::Adapters::CacheStore
- Inherits:
-
Object
- Object
- Cashier::Adapters::CacheStore
- Defined in:
- lib/cashier/adapters/cache_store.rb
Class Method Summary collapse
- .clear ⇒ Object
- .delete_tag(tag) ⇒ Object
- .get_fragments_for_tag(tag) ⇒ Object
- .keys ⇒ Object
- .remove_tags(tags) ⇒ Object
- .store_fragment_in_tag(fragment, tag) ⇒ Object
- .store_tags(tags) ⇒ Object
- .tags ⇒ Object
Class Method Details
.clear ⇒ Object
35 36 37 38 |
# File 'lib/cashier/adapters/cache_store.rb', line 35 def self.clear () Rails.cache.delete(Cashier::CACHE_KEY) end |
.delete_tag(tag) ⇒ Object
31 32 33 |
# File 'lib/cashier/adapters/cache_store.rb', line 31 def self.delete_tag(tag) Rails.cache.delete(tag) end |
.get_fragments_for_tag(tag) ⇒ Object
27 28 29 |
# File 'lib/cashier/adapters/cache_store.rb', line 27 def self.get_fragments_for_tag(tag) Rails.cache.read(tag) || [] end |
.keys ⇒ Object
40 41 42 |
# File 'lib/cashier/adapters/cache_store.rb', line 40 def self.keys .inject([]) { |arry, tag| arry += Rails.cache.fetch(tag) }.compact end |
.remove_tags(tags) ⇒ Object
17 18 19 20 21 |
# File 'lib/cashier/adapters/cache_store.rb', line 17 def self.() = Rails.cache.fetch(Cashier::CACHE_KEY) || [] = ( - ).uniq Rails.cache.write(Cashier::CACHE_KEY, ) end |
.store_fragment_in_tag(fragment, tag) ⇒ Object
4 5 6 7 8 |
# File 'lib/cashier/adapters/cache_store.rb', line 4 def self.store_fragment_in_tag(fragment, tag) fragments = Rails.cache.fetch(tag) || [] new_fragments = fragments + [fragment] Rails.cache.write(tag, new_fragments) end |