Open
Description
Currently the result of a Page.find_all
is a lazy enumerable. If we rework this to be more of a "Relation" type object, we could concievably add cache keys to it.
pages = Pages.find_all
Rails.cache.fetch(pages.cache_key, version: pages.cache_version) { pages.to_a }
This would work by executing a query to the CDN to take the top 1 entry ordered by updatedAt
descending. That updatedAt
would then become the cache_version
. documentation here: https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/order
This could also be a good solution to the problem of find_by caching: #18
Metadata
Assignees
Labels
No labels