Local metadata link commit at 2025-06-06 15:40:57 — file:///home/mrhavens/git-local-repos/git-sigil.git

This commit is contained in:
Mark Randall Havens 2025-06-06 15:40:57 -05:00
commit b548318725
134 changed files with 15789 additions and 0 deletions

View file

@ -0,0 +1,17 @@
import Redis from 'ioredis'
const client = new Redis(import.meta.env.REDIS_URI)
export const getViewsBySlug = async (slug: string) => {
if (slug) {
const prevValue = await client.get(slug);
let newValue = 1;
if (prevValue) {
newValue = parseInt(`${prevValue}`) + 1;
await client.set(slug, newValue);
} else {
await client.set(slug, 1);
}
return newValue;
}
return 0;
};