question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[feature] Status check for cache.update

See original GitHub issue

I noticed cache.update rules will only apply if request resolves but it would also be helpful if rules applied during a bad status.

async function createItem(type, data) {
  var response = await axios.post("/items", data, {
    cache: {
      update: {
        [`item-list-${type}`]: "delete"
      }
    }
  });
  return response.data.id;
}

In the case described above, I’m trying to delete cache for GET request with id item-list-x but there are cases like a status 409 conflict that I would rather it was deleted too.

Something like statusCheck would help perhaps.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
CatchABuscommented, Nov 17, 2022

Well, I guess you’ll have to delete it manually by interacting it directly to the storage.

https://axios-cache-interceptor.js.org/#/pages/invalidating-cache?id=invalidating-the-local-cache

We’re doing better docs, but to replicate the above example, you just need to call this code after your axios call.

await axios.get(...)

await axios.storage.delete(/* id */ `item-list-${type}`);

I see. Thanks for helping me out!

0reactions
arthurfiorettecommented, Nov 17, 2022

Thanks! I’ll add a section about this on the new docs were doing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Map cache updates—ArcGIS Server
This setting checks the folders of your cache and creates any tiles that are missing. As with the other update modes, you can...
Read more >
Advanced topics on caching in Apollo Client
This article describes special cases and considerations when using the Apollo Client cache. Bypassing the cache. Sometimes you shouldn't use the cache for...
Read more >
Sophos Central Server: Update Cache and Message Relay ...
When an Update Cache is available, all devices are configured to update from it and from Sophos. Every time a device updates, the...
Read more >
Checking cache | Fastly Help Guides
Follow the steps below to check the cache status of an object using the Fastly web interface: ... Click the Check Cache button....
Read more >
Microsoft Connected Cache - Configuration Manager
Windows Update for Business: Windows feature and quality updates. Office Click-to-Run apps: Microsoft 365 Apps and updates. Client apps: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found