
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Something with cache ig. Utilities for Caching / Data Fallback Handling.
Using npm
:
npm install cache-fns
or if you prefer to use the yarn
package manager:
yarn add cache-fns
or if you prefer to use the pnpm
package manager:
pnpm add cache-fns
useCache takes in as it's first parameter the key that will be sent to getter and setter functions to retrieve/store data.
Further arguments will be used in order to determine how the data is stored and retrieved.
In the example bellow, myLocalCache and myRemoteCache are imaginary caches that we use to demonstrate the function.
const data = await useCache<OurReturnType>(
'myKey',
// Resolver with both getter and setter
{
get: async (key) => {
// Get the key from our local cache
return await myLocalCache.get(key);
},
set: async (key, value) => {
// Set the key in our local cache
await myLocalCache.set(key, value);
},
},
// Resolver with only getter
async (key) => {
// Get the key from our remote cache
return await myRemoteCache.get(key);
}
);
This package is licensed under the GNU Lesser General Public License.
FAQs
Something with cache ig. Utilities for Caching / Data Fallback Handling
The npm package cache-fns receives a total of 2 weekly downloads. As such, cache-fns popularity was classified as not popular.
We found that cache-fns 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.