cachios | Simple axios cache wrapper using node-cache | Caching library
kandi X-RAY | cachios Summary
kandi X-RAY | cachios Summary
A simple axios cache wrapper using node-cache.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Internal function to handle the request .
- Add data to css prototype
- Main entry point
- Creates a new Catsios object .
- Alias of data methods
- Alias used to create a dusesses method .
- The default method is used to generate the cache identifiers
- Default response implementation .
- Returns the number of entries in the cache .
cachios Key Features
cachios Examples and Code Snippets
Community Discussions
Trending Discussions on cachios
QUESTION
I have a firebase cloud function that uses express middleware to generate an authToken which is passed on up through the routes.
This token lasts 24 hr's so I don't want to spam the service with excessive requests. As such I want to cache the result for a while before regenerating it.
I considered two approaches.
- See how to cache the axios request when generating the token.
- Use Firebase Secret Manager to store the value.
Whilst researching the axios caching, I already had secret manager in use so have implemented both in parallel.
Secret Manager
Currently I have implemented secret manager to store and update the token, when I need the token for the external API, I can just grab it from secret manager..
I have a scheduled job that then creates a new token, and subsequently disables all prior secret versions before adding in the new token.
Creating the token is achieved by using axios to call the auth end point of the external API.
Axios Caching When it comes to finding out how to enable caching for express running on cloud functions. I'm currently getting the impression that it involves adding in another layer of complexity, such as either a CDN, or Redis solution.
I've also seen intermediate cache solutions such as https://github.com/AlbinoDrought/cachios which looks like it leverages local memory of some sort. Which I assume would mean that cloud functions distributed across different regions/instances would have there own unique local cache. I wouldn't know if this is a problem or not. But would I think be more lightweight in configuration and setup than say redis?
My Problem is, and I hope this isn't too opinion based for SO. but.
Is this use of secret manager a really bad idea. Given secret manager is generally I think geared around long lived values that don't change that often. Or is it perfectly fine, that if I have 2 requests a day, that could be 2x365 versions a year logged against the secret manager, which would have to be tidied up everynow and then. Are the implications I'm not aware of?
Or is enabling some sort of CDN or express caching layer a much more standard approach? And if so is there any guidance on a simple express caching layer that's geared specifically for google Firebase cloud functions?
...ANSWER
Answered 2022-Feb-25 at 18:582 requests per day is fine. See the documentation on rotating keys here: https://cloud.google.com/secret-manager/docs/rotation-recommendations
Note that it suggests, in approach 2 & 3, that valid use cases include grabbing secrets on each launch, and grabbing secrets continuously. 2x/day is less frequent than both of these.
QUESTION
I use axios in my React-Native app
first , configure the headers
...ANSWER
Answered 2020-Apr-15 at 08:27You can try to add cache buster in the URL - forcing each request to consider as new:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install cachios
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page