Skip to content

Commit

Permalink
Removed redundant cache updates in the DataCache class.
Browse files Browse the repository at this point in the history
  • Loading branch information
torikushiii committed Aug 23, 2024
1 parent 760a41b commit 3861f66
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions hoyolab-modules/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,7 @@ module.exports = class DataCache {
if (cachedData) {
app.Logger.debug("Cache", `Cache hit for key: ${key} (memory)`);

const updatedData = await this.#updateCachedData(cachedData);

DataCache.data.set(key, updatedData);
await app.Cache.set({ key, value: updatedData, expiry: this.expiration });

return updatedData;
return await this.#updateCachedData(cachedData);
}

// 2. Attempt to get data from keyv cache
Expand All @@ -64,9 +59,7 @@ module.exports = class DataCache {
app.Logger.debug("Cache", `Cache hit for key: ${key} (keyv)`);

const updatedData = await this.#updateCachedData(cachedData);

DataCache.data.set(key, updatedData);
await app.Cache.set({ key, value: updatedData, expiry: this.expiration });

return updatedData;
}
Expand Down

0 comments on commit 3861f66

Please sign in to comment.