Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

252
Vistas
Clearing Cache in PWA

I want to develop an offline capable progressive web application.

Looking into an example of such an app - airhorner I find that it uses specific version of the application to make sure correct version is loaded.

https://github.com/GoogleChromeLabs/airhorn/blob/main/app/sw.js#L21

However what happens with older version? Do I need to cleanup it? My app is rather large because it contains lots of data (html+js ~1.5MB) and from what I read on iOS there is limit of 50MB of cache per app.

So I wonder if I need to make sure I remove cache of older versions or I can just assume it is cache and it will be removed because it is too old?

if I do need to remove older version, where is the correct place to call it?

I see in https://stackoverflow.com/a/45468998/66522 that it is called for activate event. Can I just add another event listener on this event in addition to this one? https://github.com/GoogleChromeLabs/airhorn/blob/main/app/sw.js#L40

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

A cache is volatile. The browser may choose to delete everything, or nothing, at any given time. (Ref: Deleting cache)

That being said, it's common practice to clean up after yourself. This becomes especially important when you have a limitation on 50Mb; You don't want the browser to automatically clear a valid cache.

You should do any kind of cleanup in the activate event, so that any old and active ServiceWorkers will still be able to function until the new ServiceWorker has claimed all clients (Become active).

Here's an example of how to manage cache in a ServiceWorker.

about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda