mirror of
https://github.com/SukkaW/Surge.git
synced 2026-02-03 12:31:54 +08:00
Feat: implement HTTP 304 with SQLite Cache (#42)
This commit is contained in:
@@ -1,18 +1,16 @@
|
||||
import { parseFelixDnsmasq } from './lib/parse-dnsmasq';
|
||||
import { parseFelixDnsmasqFromResp } 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, createCacheKey } from './lib/cache-filesystem';
|
||||
import { deserializeArray, fsFetchCache, serializeArray, getFileContentHash } from './lib/cache-filesystem';
|
||||
import { DomainsetOutput } from './lib/create-file';
|
||||
|
||||
const cacheKey = createCacheKey(__filename);
|
||||
|
||||
const url = 'https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/apple.china.conf';
|
||||
export const getAppleCdnDomainsPromise = createMemoizedPromise(() => fsFetchCache.apply(
|
||||
cacheKey(url),
|
||||
() => parseFelixDnsmasq(url),
|
||||
export const getAppleCdnDomainsPromise = createMemoizedPromise(() => fsFetchCache.applyWithHttp304(
|
||||
url,
|
||||
getFileContentHash(__filename),
|
||||
parseFelixDnsmasqFromResp,
|
||||
{
|
||||
ttl: TTL.THREE_DAYS(),
|
||||
serializer: serializeArray,
|
||||
deserializer: deserializeArray
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user