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.
npm i --save @zugriff/redis
import { Redis } from '@zugriff/redis';
const client = new Redis(
process.env.ZUGRIFF_REDIS_TOKEN || {
host: 'localhost',
port: 6379,
}
);
await client.cmd('SET', 'number', 1); // { anchor: 'id', data: 'OK' }
await client.cmd('SET', 'json', { hello: 'world' }); // { anchor: 'id', data: 'OK' }
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' } }