1.0.1 • Published 1 year ago

@zugriff/redis v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@zugriff/redis

This package is part of the zugriff ecosystem. It runs on both Edge Runtimes using the fetch API and your machine using the fetch API or the ioredis package.

Usage

npm i --save @zugriff/redis

Creating a client

import { Redis } from '@zugriff/redis';

const client = new Redis(
  process.env.ZUGRIFF_REDIS_TOKEN || {
    host: 'localhost',
    port: 6379,
  }
);

Executing a command

await client.cmd('SET', 'number', 1); // { anchor: 'id', data: 'OK' }
await client.cmd('SET', 'json', { hello: 'world' }); // { anchor: 'id', data: 'OK' }

Querying a value

const value = await client.cmd<number>('GET', 'number'); // { anchor: 'id', data: 1 }
const value = await client.cmd<{ hello: string }>('GET', 'json'); // { anchor: 'id', data: { hello: 'world' } }
1.0.1

1 year ago

1.0.0

1 year ago