nuxt-multi-cache icon indicating copy to clipboard operation
nuxt-multi-cache copied to clipboard

Implement client-side caching in useDataCache()

Open dulnan opened this issue 1 year ago • 2 comments

As a follow-up to #25 that introduced client-side caching in useCachedAsyncData, explore options to also add client-side caching to useDataCache, possibly reusing/sharing code from useCachedAsyncData.

dulnan avatar Jul 06 '24 08:07 dulnan

Hi, sorry to bother you again. I think my question might be related to the previous one. Is there a way to retrieve data from useRouteCache() during client-side navigation?

When I first visit the website, it correctly fetches the data from the cache. However, during subsequent client-side navigation, it queries the CMS again. Is it possible to avoid this behavior?

Thank you in advance

plcdnl avatar Dec 02 '24 09:12 plcdnl

Sorry, just saw the reply now.

Is there a way to retrieve data from useRouteCache() during client-side navigation?

Did you mean useDataCache here? If yes, then the answer is no, it's not possible to directly access the data cache on the client side, since it only "exists" on the server. Once this feature in this issue is implemented you could have a separate data cache that only exists in the browser. It would work pretty much the same as on the server, just that they are "detached" from each other.

dulnan avatar Feb 15 '25 09:02 dulnan