Предположим, есть список элементов, отображаемых и хранящихся в кэше.Если я выполняю какие-либо операции CRUD с этими элементами, он всегда извлекает данные из кэша и отображает их, которые устарели.Можно ли хранить живые данные в кеше?
self.addEventListener('fetch', function(event) {
console.log("Inside fetch");
event.respondWith(
// Try the network
fetch(event.request)
.then(function(res) {
console.log('from network');
return caches.open(CACHE_DYNAMIC_NAME)
.then(function(cache) {
// Put in cache if succeeds
cache.put(event.request.url, res.clone());
return res;
})
})
.catch(function(err) {
// Fallback to cache
console.log('from cache');
return caches.match(event.request);
})
);
});