sonicjs icon indicating copy to clipboard operation
sonicjs copied to clipboard

Set Cache expiration

Open lane711 opened this issue 1 year ago • 0 comments

The data tier automatically caches responses per here: https://sonicjs.com/persistance#caching-in-memory-and-kv-cache

We need to establish methods to invalidate the cache so that it is re-retrieving from D1. Initially we can simply set a time bases cache time

The default will be 10 minutes, but can be overridden in the config(wrangler.toml) Applicable code: https://github.com/lane711/sonicjs/blob/main/src/cms/data/data.ts#L22

Applicable integration test to expand: https://github.com/lane711/sonicjs/blob/main/src/cms/data/data.test.ts#L11

In future stories, this will be longer-living and based on data updates to maximize performance.

lane711 avatar Aug 14 '23 21:08 lane711