Class: Isomorfeus::Professional::MemcachedComponentCache
- Defined in:
- lib/isomorfeus/react/memcached_component_cache.rb
Instance Method Summary collapse
- #fetch(key) ⇒ Object
-
#initialize(*args) ⇒ MemcachedComponentCache
constructor
A new instance of MemcachedComponentCache.
- #store(key, rendered_tree, response_status, styles) ⇒ Object
Constructor Details
#initialize(*args) ⇒ MemcachedComponentCache
Returns a new instance of MemcachedComponentCache.
4 5 6 |
# File 'lib/isomorfeus/react/memcached_component_cache.rb', line 4 def initialize(*args) @dalli_client = Dalli::Client.new(*args) end |
Instance Method Details
#fetch(key) ⇒ Object
8 9 10 11 |
# File 'lib/isomorfeus/react/memcached_component_cache.rb', line 8 def fetch(key) json = @dalli_client.get(key) Oj.load(json, mode: :strict) end |
#store(key, rendered_tree, response_status, styles) ⇒ Object
13 14 15 16 |
# File 'lib/isomorfeus/react/memcached_component_cache.rb', line 13 def store(key, rendered_tree, response_status, styles) json = Oj.dump([rendered_tree, response_status, styles], mode: :strict) @dalli_client.set(key, json) end |