MCPcopy Index your code
hub / github.com/MALSync/MALSync / getRulesCacheKey

Function getRulesCacheKey

src/_provider/singleFactory.ts:49–69  ·  view source on GitHub ↗
(
  url: string,
)

Source from the content-addressed store, hash-verified

47}
48
49export async function getRulesCacheKey(
50 url: string,
51): Promise<{ rulesCacheKey: string | number; singleObj? }> {
52 const cacheObj = new Cache(`rulesCacheKey/${url}`, 7 * 24 * 60 * 60 * 1000);
53
54 if (await cacheObj.hasValue()) {
55 return cacheObj.getValue().then(res => {
56 return {
57 rulesCacheKey: res,
58 };
59 });
60 }
61
62 const singleObj = getSingle(url);
63 await singleObj.update();
64 cacheObj.setValue(singleObj.getRulesCacheKey());
65 return {
66 rulesCacheKey: singleObj.getRulesCacheKey(),
67 singleObj,
68 };
69}

Callers 1

initRulesMethod · 0.90

Calls 4

hasValueMethod · 0.95
getValueMethod · 0.95
setValueMethod · 0.95
getSingleFunction · 0.70

Tested by

no test coverage detected