mirror of
https://github.com/umami-software/umami.git
synced 2026-02-12 08:37:13 +01:00
Refactored redis usage. Added lib/cache.
This commit is contained in:
parent
3485b6268b
commit
f118bc95c1
22 changed files with 236 additions and 221 deletions
|
|
@ -1,16 +1,7 @@
|
|||
import prisma from 'lib/prisma';
|
||||
import redis from 'lib/redis';
|
||||
|
||||
export async function getWebsite(where) {
|
||||
return prisma.client.website
|
||||
.findUnique({
|
||||
where,
|
||||
})
|
||||
.then(async data => {
|
||||
if (redis.enabled && data) {
|
||||
await redis.set(`website:${data.id}`, data);
|
||||
}
|
||||
|
||||
return data;
|
||||
});
|
||||
return prisma.client.website.findUnique({
|
||||
where,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue