Class: WCC::Contentful::Store::LazyCacheStore::Query::ResponseWrapper
- Inherits:
-
Struct
- Object
- Struct
- WCC::Contentful::Store::LazyCacheStore::Query::ResponseWrapper
- Defined in:
- lib/wcc/contentful/store/lazy_cache_store.rb
Instance Method Summary collapse
Instance Method Details
#includes ⇒ Object
138 139 140 |
# File 'lib/wcc/contentful/store/lazy_cache_store.rb', line 138 def includes @includes ||= IncludesWrapper.new(response, cache) end |
#items ⇒ Object
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/wcc/contentful/store/lazy_cache_store.rb', line 122 def items @items ||= response.items.map do |item| id = item.dig('sys', 'id') prev = cache.read(id) unless (prev_rev = prev&.dig('sys', 'revision')) && (next_rev = item.dig('sys', 'revision')) && next_rev < prev_rev cache.write(id, item) end item end end |