watermarkchurch / wcc-contentful

An alternative to Contentful's contentful.rb ruby client, contentful_model, and contentful_rails gems all in one.
MIT License
2 stars 1 forks source link

Improve multi-locale caching in CachingMiddleware #273

Open gburgett opened 1 year ago

gburgett commented 1 year ago

Currently, the caching middleware will store in the cache the first localized version of the entry that gets requested. Then, if another locale is requested, that will be a miss and will delegate to a store.find. This happens until that specific entry changes and we index the full locale entry.

If we request a second locale for the same entry, we should merge that locale into the original localized entry to create a partial locale=* entry.

We have to be careful to track which locales got merged into this partial entry, and continue to delegate to the store if we request a locale that is not in the merged entry yet.