Rocky_Mountain_Vending/.pnpm-store/v10/files/92/bdf2275f7d43fed94337ca1bcfc01f9f059f4749dfa7ef7fedd0c7521068478a92a95cffcab5c73b78d75a20c050c76b29ba49047558a3a7d1dbd1098e5a96
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

39 lines
1 KiB
Text

export class S3ExpressIdentityCache {
data;
lastPurgeTime = Date.now();
static EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS = 30_000;
constructor(data = {}) {
this.data = data;
}
get(key) {
const entry = this.data[key];
if (!entry) {
return;
}
return entry;
}
set(key, entry) {
this.data[key] = entry;
return entry;
}
delete(key) {
delete this.data[key];
}
async purgeExpired() {
const now = Date.now();
if (this.lastPurgeTime + S3ExpressIdentityCache.EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS > now) {
return;
}
for (const key in this.data) {
const entry = this.data[key];
if (!entry.isRefreshing) {
const credential = await entry.identity;
if (credential.expiration) {
if (credential.expiration.getTime() < now) {
delete this.data[key];
}
}
}
}
}
}