Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
dragonfly-redis-prisma-cache
Advanced tools
Readme
A Cache middleware for dragonfly (faster then redis), which still can be used with redis.
npm i Tomato6966/dragonfly-redis-prisma-cache
First you should always cache a database for GET-QUERY REQUESTS. This way you reduce traffic on a database. Prisma is very great as this way you can use postgresql / mongodb / mysql... with the same wrapper! and still are able to use this cache with all dbs!
It's the most optimal, when beeing used with dragonfly Because dragonfly is like redis, yet it has multithreading and can handle hundred of thousands requests at the same time!
This package is better then other cache wrappers cause it invalidates only thigns related to what you change!
You can still use it with regular redis tho.
Why no invalidation based on cache size?
wget https://github.com/dragonflydb/dragonfly/releases/latest/download/dragonfly-x86_64.tar.gz && tar -xvzf dragonfly-x86_64.tar.gz && rm dragonfly-x86_64.tar.gz
./dragonfly-x86_64 --logtostderr --requirepass=youshallnotpass --bind localhost --port 6739 --hz=10 --save_schedule "*:30" --maxmemory 4294967296 --dbfilename dump.rdb
echo "./dragonfly-x86_64 --logtostderr --requirepass=youshallnotpass --bind localhost --port 6739 --hz=10 --save_schedule "*:30" --maxmemory 4294967296 --dbfilename dump.rdb" > startdragonfly.sh
chmod +rwx startdragonfly.sh
# e.g. with pm2
pm2 start --name dragonflycache ./startdragonfly.sh
import { PrismaClient } from '@prisma/client'
import { prismaDragonflyRedisCache } from 'dragonfly-redis-prisma-cache';
const prisma = new PrismaClient();
prisma.$use(prismaDragonflyRedisCache({
storageOptions:{
// connection hostname/ipaddress
host: "localhost",
// Port for the dragonfly instance
port: 6379,
// your password don't provide it if not needed
password: "youshallnotpass",
// when to cancel the requests after X milli-seconds
timeout: 2000,
/** If undefined | <= 0 then no Pool will be used */
min_conn: 100,
// dragonfly can handle hundred of thousands connections at once
max_conn: 1000,
// tls: {
// key: Buffer.from("key_string"),
// cert: Buffer.from("cert_string"),
// };
},
useAllModels: true, //overwrites toCache
defaultCacheActions: [ "findUnique", "findFirst", "findMany", "count", "aggregate", "groupBy", "findRaw", "aggregateRaw" ],
defaultTTL: 0, // amount of ttl for on default
toCache: [
{
model: 'Users',
actions: ['findFirst', "findUnique", "count"],
ttl: 60,
keyPrefix: 'usrs'
},
{
model: 'Users',
actions: ['findFirst', "findUnique", "count"],
}
]
}));
export default prisma;
example how i do it:
const { getRedisDataOfURL, prismaDragonflyRedisCache } = require("dragonfly-redis-prisma-cache");
prisma.$use(prismaDragonflyRedisCache({
storageOptions: {
...(getRedisDataOfURL("redis://:password@127.0.0.1:6739")),
min_conn: 100,
max_conn: 1000,
},
useAllModels: true,
defaultCacheActions: [ "findUnique", "findFirst", "findMany", "count", "aggregate", "groupBy", "findRaw", "aggregateRaw" ],
}));
npm run build
npm run lint
npm run format
Documatic is a search engine for your codebase; Ask documatic a question and find relevant code snippets and insights in seconds.
https://www.documatic.com/ Documatic acts as a search engine for your codebase; once you describe what you're looking for, Documatic pulls up related code or documentation making it easier to find what you're looking for in seconds!
Not sitting next to each other? No problem. Ask Documatic questions of your codebase to learn and understand your code in seconds. Documatic is the team member you wish you had
Our Visual studio Code extension: https://marketplace.visualstudio.com/items?itemName=Documatic.documatic https://cdn.discordapp.com/attachments/926110059782615071/1037404343470661713/Documatic_sh6hrz.gif
FAQs
A Cache middleware for dragonfly (faster then redis), which still can be used with redis.
The npm package dragonfly-redis-prisma-cache receives a total of 0 weekly downloads. As such, dragonfly-redis-prisma-cache popularity was classified as not popular.
We found that dragonfly-redis-prisma-cache 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.