Public
Script
Readme

Upstash Redis

For more methods, see Upstash Docs

1
2
3
4
5
6
7
8
9
10
11
12
13
import { Redis } from "npm:@upstash/redis";
const redis = new Redis({
url: Deno.env.get("upstashURL"),
token: Deno.env.get("upstashToken"),
});
// Just string
// console.log(await redis.set("foo", "bar")); // OK
// console.log(await redis.get("foo")); // bar
// JSON
await redis.set("json-ex-1", { a: { b: "nested json" } });
console.log(((await redis.get("json-ex-1")) as any).a.b);
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
July 26, 2024