hapijs / catbox

Multi-strategy object caching service
Other
494 stars 72 forks source link

support cache dependency #199

Closed callmez closed 6 years ago

callmez commented 6 years ago

hi, for some scenario we need some good solution to hit cache better. such as php yii2 framework cache dependency

// Create a dependency on the modification time of file example.txt.
const dependency = new FileDependency({ fileName: 'example.txt' });

// The data will expire in 30 seconds.
// It may also be invalidated earlier if example.txt is modified.
await cache.set(key, data, 30, dependency);

// The cache will check if the data has expired.
// It will also check if the associated dependency was changed.
// It will return false if any of these conditions are met.
data = await cache.get(key);

unfortunately i didn't found any support from npm packages. it will be nice if you guys enhance cache dependency(interface) support. Thanks!

hueniverse commented 6 years ago

We are not going to add this to catbox but you can write a catbox provider like the ones for redis, mongo, etc which does this.

lock[bot] commented 4 years ago

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.