Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Cache deleted on reload page #256

Open
ptiswitz opened this issue Jul 7, 2017 · 5 comments
Open

Cache deleted on reload page #256

ptiswitz opened this issue Jul 7, 2017 · 5 comments

Comments

@ptiswitz
Copy link

ptiswitz commented Jul 7, 2017

Hi everyone,

I'm facing a really strange issue and i need a little help.

I'm trying to cache some urls on the fly (user action). This point works well, all my urls which have the same base url (/rest/events/...), are inserted in the cache storage.

But when the page is reload only one is still there and the other one seem to be remove during the toolbox init phase.

Does anyone have an idea to solve this issue ?

Thanks

@gauntface
Copy link

can you share an example project or URL that shows this behavior?

@ptiswitz
Copy link
Author

Hello,

Sorry for the delay but you can see the code on this gist https://gist.github.com/ptiswitz/ef40a69eb8b3d730f7d9853c77fd6a24

There is no live example, i'm sorry :)

@ptiswitz
Copy link
Author

I debug step by step the toolbox script and i found that during the active phase the renameCache function is called.

It's literally replace the "previous" cache by a new one without getting back any request stored in it.

Does it have a reason to do that ?

@gauntface
Copy link

the activate phase means that the previous precached resources are no longer in use and can be deleted while the newly precached assets (which is performed in the install event) will be used now.

@gauntface
Copy link

You might find workboxjs.org a better option to achieve what you are doing as you're using toolbox and sw-precache to precache assets and I think you would be better suited to using a specific cache for your on the fly caching which I'm not sure how you can do that in sw-toolbox.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants