feat: auth & admin

This commit is contained in:
2026-06-03 10:41:53 +03:00
parent 612d0f0125
commit 7dc59fb3c4
120 changed files with 4683 additions and 2159 deletions
@@ -12,20 +12,20 @@ tags: server, cache, lru, cross-request
**Implementation:**
```typescript
import { LRUCache } from 'lru-cache'
import { LRUCache } from 'lru-cache';
const cache = new LRUCache<string, any>({
max: 1000,
ttl: 5 * 60 * 1000 // 5 minutes
})
ttl: 5 * 60 * 1000, // 5 minutes
});
export async function getUser(id: string) {
const cached = cache.get(id)
if (cached) return cached
const cached = cache.get(id);
if (cached) return cached;
const user = await db.user.findUnique({ where: { id } })
cache.set(id, user)
return user
const user = await db.user.findUnique({ where: { id } });
cache.set(id, user);
return user;
}
// Request 1: DB query, result cached