From c5fabc5fc2d84e24b38431ba78f882c06c5543ab Mon Sep 17 00:00:00 2001 From: Malik Whitten <65188863+MalikWhitten67@users.noreply.github.com> Date: Sat, 22 Jun 2024 07:58:06 -0600 Subject: [PATCH] Switch cache policy Switched cache policy to 1h for users and 1 minute for other items --- core/controllers/CrudManager.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/controllers/CrudManager.ts b/core/controllers/CrudManager.ts index ddee523..910474f 100644 --- a/core/controllers/CrudManager.ts +++ b/core/controllers/CrudManager.ts @@ -226,7 +226,7 @@ export default class CrudManager { this.Cache.setCache(data.collection, data.cacheKey, d, 3600) setTimeout(()=>{ this.Cache.clear(data.collection, data.cacheKey) - }, 3600000) + }, data.collection === 'users' ? 3600000 : 60000) // 1 hour for users, 1 minute for others return {error: false, message: 'success', key: data.key, data: d, session: data.session} } @@ -275,6 +275,9 @@ export default class CrudManager { if(cache.exists(collection, cacheKey)){ cache.clear(collection, cacheKey) } + if(collection === 'users' && cache.exists('users', `posts-${id}`)){ + cache.clear('users', `posts-${id}`) + } for (let i in data.data) { if (data.data[i].isFile && data.data[i].file) { let files = handleFiles(data.data[i].file); @@ -359,7 +362,7 @@ export default class CrudManager { this.Cache.setCache(collection, cacheKey, d, 3600) setTimeout(()=>{ this.Cache.clear(collection, cacheKey) - }, 3600000) + }, collection === 'users' ? 3600000 : 60000) // 1 hour for users, 1 minute for others return {error: false, message: 'success', key: key, data: d, session: session} } }