- Added schema for users, licenses, and license hostnames in the database. - Created storage utility for reading and writing JSON files. - Developed user service for user registration, authentication, and retrieval. - Implemented authentication middleware to protect routes. - Built LicenseCard component to display license details. - Created SiteNav component for navigation with user authentication status. - Established AuthContext for managing authentication state and actions. - Developed Home page to display available plugins. - Created LicenseManager page for managing licenses with forms for creation and verification. - Implemented PluginDetail page to show detailed information about a specific plugin. - Added utility functions for date formatting.
22 lines
475 B
JavaScript
22 lines
475 B
JavaScript
import { CACHE_TTL_MS } from "./config.js";
|
|
|
|
const cache = new Map();
|
|
|
|
export function getCached(key) {
|
|
const entry = cache.get(key);
|
|
if (!entry) return null;
|
|
if (Date.now() > entry.expiresAt) {
|
|
cache.delete(key);
|
|
return null;
|
|
}
|
|
return entry.value;
|
|
}
|
|
|
|
export function setCached(key, value, ttlMs = CACHE_TTL_MS) {
|
|
cache.set(key, { value, expiresAt: Date.now() + ttlMs });
|
|
}
|
|
|
|
export function clearCached(key) {
|
|
cache.delete(key);
|
|
}
|