You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During development, especially while doing only style changes I wanna do a request to an API like 1000ths of times but I don't expect the response to differ - so just using the cache all the time would be fine.
I expected something like this work
import{Ajax}from"@lion/ajax";exportconstajax=newAjax({addCaching: true,cacheOptions: {useCache: true,},});// 👆 defining it double seems kinda strange?ajax.fetch('api.foo');// does request for real ✅ajax.fetch('api.foo');// gives cache ✅ajax.fetch('api.foo');// gives cache ✅// reload page // expectedajax.fetch('api.foo');// gives cache// actualajax.fetch('api.foo');// does request for real
I assume the cache is only stored in memory which means on every reload you need to do all requests again... which might make sense for a SPA but not while developing or when using an MPA 😅
Proposed Solution
Maybe add an additional option to define the cache to be persisted via local storage?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
During development, especially while doing only style changes I wanna do a request to an API like 1000ths of times but I don't expect the response to differ - so just using the cache all the time would be fine.
I expected something like this work
I assume the cache is only stored in memory which means on every reload you need to do all requests again... which might make sense for a SPA but not while developing or when using an MPA 😅
Proposed Solution
Maybe add an additional option to define the cache to be persisted via local storage?
could be like this
To not use the persistent cache you would need to "change" your code to
persist: false
...?But how to get rid of it? how to do cleanup?
and ideas/opinions?
Beta Was this translation helpful? Give feedback.
All reactions