🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

prisma-upstash-middleware

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prisma-upstash-middleware

Prisma query caching middleware

0.2.0
latest
Source
npm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

Prisma Upstash Middleware

Prisma query caching middleware to Upstash Redis with automatic date-strings conversion

Install

pnpm add prisma-upstash-middleware

Usage

import { PrismaClient } from "@prisma/client";
import { Redis } from "@upstash/redis";
import upstashMiddleware from "prisma-upstash-middleware";

const prisma = new PrismaClient();
const redis = Redis.fromEnv();

prisma.$use(
 upstashMiddleware({
  redis: redis,
  models: ["User", "Post"],
  actions: ["findUnique", "findMany"],
  args: { ex: 300 },
 }),
);

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Prerequisite before building

There will be errors like error TS2305: Module '"@prisma/client"' has no exported member 'Prisma'. if this not done:

  • Run pnpm install
  • Run pnpm exec prisma init
  • Add Prisma model to prisma/schema.prisma
  • Run pnpm exec prisma generate
  • Run pnpm build

Not necessarily pnpm, you are free to use any other Package Manager

Prisma model example

model User {
  id String @id @default(cuid())
}

License

This project is licensed under the MIT License.

Keywords

prisma

FAQs

Package last updated on 17 May 2023

Did you know?

Socket

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.

Install

Related posts