Chore: add cache key to fs cache

This commit is contained in:
SukkaW
2024-08-04 23:13:23 +08:00
parent 32ef8ef7b6
commit f761546a05
7 changed files with 85 additions and 16 deletions

View File

@@ -5,10 +5,12 @@ import { parseFelixDnsmasq } from './lib/parse-dnsmasq';
import { task } from './trace';
import { SHARED_DESCRIPTION } from './lib/constants';
import { createMemoizedPromise } from './lib/memo-promise';
import { TTL, deserializeArray, fsFetchCache, serializeArray } from './lib/cache-filesystem';
import { TTL, deserializeArray, fsFetchCache, serializeArray, createCacheKey } from './lib/cache-filesystem';
const cacheKey = createCacheKey(__filename);
export const getAppleCdnDomainsPromise = createMemoizedPromise(() => fsFetchCache.apply(
'https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/apple.china.conf',
cacheKey('https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/apple.china.conf'),
() => parseFelixDnsmasq('https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/apple.china.conf'),
{
ttl: TTL.THREE_DAYS(),