netlify-plugin-ttl-cache icon indicating copy to clipboard operation
netlify-plugin-ttl-cache copied to clipboard

`ttl` option of `utils.cache`

Open ehmicky opened this issue 4 years ago • 4 comments

utils.cache has a ttl option. Would this work for this plugin?

ehmicky avatar Sep 06 '21 17:09 ehmicky

The upside to the current implementation is the ttl can be backwards applied to formerly cached assets if needed.

itzsaga avatar Sep 17 '21 20:09 itzsaga

The main difference with utils.cache's ttl option is in the timestamp stored in cache:

  • It uses a single timestamp per cached directory, while this plugin uses each file's mtime
  • The timestamp is created each time utils.cache.save() is called, as opposed to when the file was last modified

Based on this, it does look like this might not work for you use case. What do you think?

ehmicky avatar Sep 20 '21 14:09 ehmicky

No particular use case. Just wanted to highlight the differences for discussion 😃.

itzsaga avatar Sep 20 '21 15:09 itzsaga

If you think the ttl option would not work for this plugin, please feel free to close this issue. I am not quite sure whether that option would be helpful or not for you. :)

ehmicky avatar Sep 20 '21 15:09 ehmicky