Refactored caching logic.

This commit is contained in:
Mike Cao 2024-04-26 00:31:38 -07:00
parent 216304a191
commit 0fc8828f8b
7 changed files with 33 additions and 142 deletions

View file

@ -1,5 +1,4 @@
import { Prisma } from '@prisma/client';
import cache from 'lib/cache';
import { ROLES } from 'lib/constants';
import prisma from 'lib/prisma';
import { FilterResult, Role, User, UserSearchFilter } from 'lib/types';
@ -221,15 +220,5 @@ export async function deleteUser(
id: userId,
},
}),
]).then(async data => {
if (cache.enabled) {
const ids = websites.map(a => a.id);
for (let i = 0; i < ids.length; i++) {
await cache.deleteWebsite(`website:${ids[i]}`);
}
}
return data;
});
]);
}