0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-17 23:44:39 -05:00

Added a reset method to the redis cache adapter

This allows us to reset cache rather than having to wait for the TTL period.
This commit is contained in:
Joe Grigg 2023-03-13 09:33:49 +00:00 committed by Fabien 'egg' O'Carroll
parent a50ef81148
commit b84ed78078

View file

@ -140,10 +140,14 @@ class AdapterCacheRedis extends BaseCacheAdapter {
} }
} }
/**
* Reset the cache by deleting everything from redis
*/
async reset() { async reset() {
// NOTE: dangerous in shared environment, and not used in production code anyway! const keys = await this.#getKeys();
// return await this.cache.reset(); for (const key of keys) {
logging.error('Cache reset has not been implemented with shared cache environment in mind'); await this.cache.del(key);
}
} }
/** /**