You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
@@ -36,7 +36,6 @@ npm install redis
|
|||||||
```typescript
|
```typescript
|
||||||
import { createClient } from 'redis';
|
import { createClient } from 'redis';
|
||||||
|
|
||||||
(async () => {
|
|
||||||
const client = createClient();
|
const client = createClient();
|
||||||
|
|
||||||
client.on('error', (err) => console.log('Redis Client Error', err));
|
client.on('error', (err) => console.log('Redis Client Error', err));
|
||||||
@@ -45,7 +44,6 @@ import { createClient } from 'redis';
|
|||||||
|
|
||||||
await client.set('key', 'value');
|
await client.set('key', 'value');
|
||||||
const value = await client.get('key');
|
const value = await client.get('key');
|
||||||
})();
|
|
||||||
```
|
```
|
||||||
|
|
||||||
The above code connects to localhost on port 6379. To connect to a different host or port, use a connection string in the format `redis[s]://[[username][:password]@][host][:port][/db-number]`:
|
The above code connects to localhost on port 6379. To connect to a different host or port, use a connection string in the format `redis[s]://[[username][:password]@][host][:port][/db-number]`:
|
||||||
|
Reference in New Issue
Block a user