mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
configure redis
This commit is contained in:
parent
efb52f5ff1
commit
48fe6ebcc5
13 changed files with 138 additions and 183 deletions
|
|
@ -14,7 +14,7 @@ export async function createWebsite(user_id, data) {
|
|||
},
|
||||
})
|
||||
.then(async res => {
|
||||
if (process.env.REDIS_URL) {
|
||||
if (process.env.REDIS_URL && res) {
|
||||
await redis.set(`website:${res.website_uuid}`, Number(res.website_id));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ export async function deleteWebsite(website_id) {
|
|||
}),
|
||||
]).then(async res => {
|
||||
if (process.env.REDIS_URL) {
|
||||
await redis.del(`website:${res.website_uuid}`);
|
||||
await redis.client.del(`website:${res.website_uuid}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,18 @@
|
|||
import prisma from 'lib/prisma';
|
||||
import redis from 'lib/redis';
|
||||
|
||||
export async function getWebsiteByUuid(website_uuid) {
|
||||
return prisma.client.website.findUnique({
|
||||
where: {
|
||||
website_uuid,
|
||||
},
|
||||
});
|
||||
return prisma.client.website
|
||||
.findUnique({
|
||||
where: {
|
||||
website_uuid,
|
||||
},
|
||||
})
|
||||
.then(async res => {
|
||||
if (process.env.REDIS_URL && res) {
|
||||
await redis.client.set(`website:${res.website_uuid}`, 1);
|
||||
}
|
||||
|
||||
return res;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue