![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
cache-client-promise
Advanced tools
simple client-side cache module. helps especially when requests are being fired so fast that the same request can be fired before the same request finishes.
A lot of tutorials and what not are solid and advise well on client side cacheing strategies. I needed a more generic cache that I could use with promises, and that could handle the scenario that if a request was fired off, and the same request was made before the first one finished, you could still get the result of the first request.
import CacheClientPromise from 'cache-client-promise'
const myCache = new CacheClientPromise();
myCache.get('article-12345', function () {
return fetch(`/api/articles/12345`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
},
credentials: 'same-origin'
})
.then(response => response.json())
})
.then((article) => {
//do something with the article
})
.catch((reason) => {
//something happened most likely in your requesting function
})
check out the tests in the repo for more examples!
This will check the cache for the key that you give to it, and if already there, will resolve immediately.
If it is not yet in the cache, it will add your cache key to it's list, where it keeps a list of internal promises of everything that requests this key.
When the first request for the key finally resolves, it will look at the promises that have been stored for itself internally and resolve them.
FAQs
client side cache
We found that cache-client-promise demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.