Closed eatyourgreens closed 2 years ago
Would passing in an optional ID, that overrides the hash, be a useful fix? I'm thinking of trying something like this for our project.
let url = 'https://api.zooniverse.org/projects/illustratedlife/talk/subjects/ASC0000q71';
let subjectData = await CacheAsset(url, {
id: 'ASC0000q71',
duration: "1d";
type: 'json'
});
Merged, shipping with 3.0.0
Hi,
I'm using this plugin to cache API responses and I've run into a problem where, occasionally, a URL will resolve to the wrong resource from our database.
The problem seems to occur here, where
shorthash
is used to generate the cache ID. https://github.com/11ty/eleventy-cache-assets/blob/4ff6669de4fecba7b74cb46decb91e890c89693d/src/RemoteAssetCache.js#L12Logging a couple of the problem URLs from out API, here's the URL,
shorthash(URL)
and the resolved resource ID. The second subjectASC0000q71
resolves as subjectASC0000qu3
.