The ideal way to cache web application data is to use IndexedDB. It is a document database in the browser and is available to both your client scripts and service worker. It is idea for JSON data, but can store binary data as well.