Skip to content

Commit

Permalink
docs(README): deno-redis should be imported from JSR (#468)
Browse files Browse the repository at this point in the history
Closes #438
  • Loading branch information
uki00a authored Dec 3, 2024
1 parent d43e6db commit 1e7a209
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
# deno-redis

[![JSR](https://jsr.io/badges/@db/redis)](https://jsr.io/@db/redis)
[![Build Status](https://github.com/denodrivers/redis/workflows/CI/badge.svg)](https://github.com/denodrivers/redis/actions)
![https://img.shields.io/github/tag/denodrivers/redis.svg](https://img.shields.io/github/tag/denodrivers/redis.svg)
[![license](https://img.shields.io/github/license/denodrivers/redis.svg)](https://github.com/denodrivers/redis)
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/redis/mod.ts)
[![Discord](https://img.shields.io/discord/768918486575480863?logo=discord)](https://discord.gg/QXuHBMcgWx)

An experimental implementation of redis client for deno

## Usage

needs `--allow-net` privilege
**Installation**

```shell
$ deno add jsr:@db/redis
```

**Permissions**

`deno-redis` needs `--allow-net` privilege

**Stateless Commands**

```ts
import { connect } from "https://deno.land/x/redis/mod.ts";
import { connect } from "@db/redis";
const redis = await connect({
hostname: "127.0.0.1",
port: 6379,
Expand All @@ -27,7 +34,7 @@ const fuga = await redis.get("hoge");
**PubSub**

```ts
import { connect } from "https://deno.land/x/redis/mod.ts";
import { connect } from "@db/redis";

const redis = await connect({ hostname: "127.0.0.1" });
const sub = await redis.subscribe("channel");
Expand All @@ -41,7 +48,7 @@ const sub = await redis.subscribe("channel");
**Streams**

```ts
import { connect } from "https://deno.land/x/redis/mod.ts";
import { connect } from "@db/redis";

const redis = await connect({ hostname: "127.0.0.1" });
await redis.xadd(
Expand All @@ -66,7 +73,7 @@ const thx = msgFV["no"];
First, if you need to set up nodes into a working redis cluster:

```ts
import { connect } from "https://deno.land/x/redis/mod.ts";
import { connect } from "@db/redis";

const redis = await connect({ hostname: "127.0.0.1", port: 6379 });

Expand All @@ -93,7 +100,7 @@ unavailable. You can change the maximum number of retries by setting
`maxRetryCount` (It's default to `10`):

```ts
import { connect } from "https://deno.land/x/redis/mod.ts";
import { connect } from "@db/redis";

const redis = await connect({ hostname: "127.0.0.1", maxRetryCount: 0 }); // Disable retries
```
Expand All @@ -105,7 +112,7 @@ const redis = await connect({ hostname: "127.0.0.1", maxRetryCount: 0 }); // Dis
commands and receive replies.

```ts
import { connect } from "https://deno.land/x/redis/mod.ts";
import { connect } from "@db/redis";

const redis = await connect({ hostname: "127.0.0.1" });

Expand All @@ -117,7 +124,7 @@ If `returnUint8Arrays` option is set to `true`, simple strings and bulk strings
are returned as `Uint8Array`

```ts
import { connect } from "https://deno.land/x/redis/mod.ts";
import { connect } from "@db/redis";

const redis = await connect({ hostname: "127.0.0.1" });

Expand All @@ -132,7 +139,7 @@ console.assert(reply instanceof Uint8Array);
https://redis.io/topics/pipelining

```ts
import { connect } from "https://deno.land/x/redis/mod.ts";
import { connect } from "@db/redis";

const redis = await connect({ hostname: "127.0.0.1" });
const pl = redis.pipeline();
Expand All @@ -159,7 +166,7 @@ and no changes will happen during execution.
See detail https://redis.io/topics/transactions

```ts
import { connect } from "https://deno.land/x/redis/mod.ts";
import { connect } from "@db/redis";

const redis = await connect({ hostname: "127.0.0.1" });
const tx = redis.tx();
Expand All @@ -179,7 +186,7 @@ await tx.flush();
https://redis.io/topics/client-side-caching

```typescript
import { connect } from "https://deno.land/x/redis/mod.ts";
import { connect } from "@db/redis";

const mainClient = await connect({ hostname: "127.0.0.1" });
const cacheClient = await connect({ hostname: "127.0.0.1" });
Expand Down

0 comments on commit 1e7a209

Please sign in to comment.