
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
@redpill-paris/quidol-redis-cache
Advanced tools
Quidol Cache used for our real time show and REST API.
QuidolCache
this will not open a new connection but use a connection already open. yarn add @redpill-paris/quidol-redis-cache
const QuidolCache = require('@redpill-paris/quidol-redis-cache');
const redisOptions = {
host: 'localhost',
port: '6379',
}
const cache = new QuidolCache({ redisOptions });
const QuidolCache = require('@redpill-paris/quidol-redis-cache');
const redisClusterOptions = [
{
host: 'localhost',
port: '6379',
},
{
host: 'localhost',
port: '6380',
},
]
const cache = new QuidolCache({ redisClusterOptions, type: 'cluster' });
const QuidolCache = require('@redpill-paris/quidol-redis-cache');
const redisSentinelOptions = {
sentinels: [
{ host: "sentinel-1", port: 26379 },
{ host: "sentinel-2", port: 26379 },
{ host: "sentinel-3", port: 26379 }
],
name: "mymaster"
}
const cache = new QuidolCache({ redisSentinelOptions, type: 'sentinel' });
cluster
or standalone
default(standalone). cache.get(key, storeFunction(optionnal))
return a Promise. If the cache is invalid or null the storeFunction will be executed and the result of this function will be stored in the cache.
const userInfo = await cache.get(
`userInfo:${userId}`,
async () => {
/* Some Async things, fetch user info from DB or other sources.
** The method passed in parameter can be sync or async it doesn't matter everything is handled in the package.
*/
...
return userInfo
}
);
cache.del(key)
Return a Promise.
await cache.del(`userInfo:${userId}`);
cache.delAll(match, count)
Return a Promise.
await cache.delAll('userInfo:*', 100);
cache.set(key, value)
Return a Promise
await cache.set(`userInfo:${userId}`, {
admin: true,
nickname: 'Kubessandra',
});
const QuidolCache = require('@redpill-paris/quidol-redis-cache');
const redisOptions = {
host: 'localhost',
port: '6379',
}
const cache = new QuidolCache({ redisOptions });
// Exemple for fetching user info with a cache of 60secs
const userId = '123456';
const userInfo = await cache.get(
`userInfo:${userId}`,
async () => {
/* Some Async things, fetch user info from DB or other sources.
** The method passed in parameter can be sync or async it doesn't matter everything is handled in the package.
*/
...
return userInfo
}
);
// I can now use my userInfo without spamming the database everytime.
console.log(userInfo);
// If the user is Updated, you can del or set the key to invalide the cache and requesting a new fetch on the next req.
await cache.del(`userInfo:${userId}`);
// If there are multiple users, you can delete all this keys
await cache.delAll('userInfo:*', 100);
FAQs
Quidol redis cache sdk
The npm package @redpill-paris/quidol-redis-cache receives a total of 26 weekly downloads. As such, @redpill-paris/quidol-redis-cache popularity was classified as not popular.
We found that @redpill-paris/quidol-redis-cache demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers 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
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Central’s incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.