mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 22:53:25 +00:00
18 lines
353 B
TypeScript
18 lines
353 B
TypeScript
import { cache } from '#core/lib/cache';
|
|
import { Favicon } from '#favicons/types/favicon_type';
|
|
|
|
export class CacheService {
|
|
private cacheNs = cache.namespace('favicon');
|
|
|
|
async getOrSetFavicon(
|
|
url: string,
|
|
factory: () => Promise<Favicon>
|
|
): Promise<Favicon> {
|
|
return this.cacheNs.getOrSet({
|
|
key: url,
|
|
ttl: '1h',
|
|
factory,
|
|
});
|
|
}
|
|
}
|