1

I'm using the JS CacheStorage API, I need to make sure that the cached request is up to date. How can I retrieve the cached time of the saved cache?

Rivka
  • 151
  • 1
  • 5

1 Answers1

2

In your cache object, you can simply store the Date.now.

Note: I would post it as a comment but I don't have the reputation for that.

Yousuf Khan
  • 318
  • 2
  • 12
  • it's still not clear how to add data to response when It cached – Rivka Aug 14 '19 at 05:23
  • 1
    To add data to a response before caching, you must reconstruct the response as seen in this answer: https://stackoverflow.com/a/35421180/5500690 – electrovir Nov 14 '19 at 19:24