feat: add access control

This commit is contained in:
41666 2021-07-18 01:57:03 -04:00
parent 9c07ff0e54
commit 3f45153b66
47 changed files with 1084 additions and 164 deletions

View file

@ -108,6 +108,10 @@ export const discordFetch = async <T>(
}
};
export type CacheLayerOptions = {
skipCachePull?: boolean;
};
export const cacheLayer =
<Identity, Data>(
kv: WrappedKVNamespace,
@ -115,10 +119,7 @@ export const cacheLayer =
missHandler: (identity: Identity) => Promise<Data | null>,
ttlSeconds?: number
) =>
async (
identity: Identity,
options: { skipCachePull?: boolean } = {}
): Promise<Data | null> => {
async (identity: Identity, options: CacheLayerOptions = {}): Promise<Data | null> => {
const key = keyFactory(identity);
if (!options.skipCachePull) {