1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00
This commit is contained in:
Leibale
2023-06-07 11:41:23 -04:00
parent eb47bb03fc
commit 05f9f0ee0d
31 changed files with 390 additions and 386 deletions

View File

@@ -90,5 +90,5 @@ await client.connect();
// Add your example code here...
await client.quit();
client.destroy();
```

View File

@@ -27,4 +27,4 @@ console.log('blpopPromise resolved');
// {"key":"keyName","element":"value"}
console.log(`listItem is '${JSON.stringify(listItem)}'`);
await client.quit();
client.destroy();

View File

@@ -77,4 +77,4 @@ const info = await client.bf.info('mybloom');
// }
console.log(info);
await client.quit();
client.destroy();

View File

@@ -25,4 +25,4 @@ console.log('Afer connectPromise has resolved...');
// isReady will return True here, client is ready to use.
console.log(`client.isOpen: ${client.isOpen}, client.isReady: ${client.isReady}`);
await client.quit();
client.destroy();

View File

@@ -1,25 +1,31 @@
// Define a custom script that shows example of SET command
// with several modifiers.
import { createClient } from 'redis';
import { createClient } from '../packages/client';
const client = createClient();
await client.connect();
await client.del('mykey');
let result = await client.set('mykey', 'myvalue', {
EX: 60,
GET: true
});
console.log(
await client.set('mykey', 'myvalue', {
expiration: {
type: 'EX',
value: 60
},
GET: true
})
); // null
console.log(result); //null
console.log(
await client.set('mykey', 'newvalue', {
expiration: {
type: 'EX',
value: 60
},
GET: true
})
); // 'myvalue'
result = await client.set('mykey', 'newvalue', {
EX: 60,
GET: true
});
console.log(result); //myvalue
await client.quit();
await client.close();

View File

@@ -23,4 +23,4 @@ try {
console.log(`GET command failed: ${e.message}`);
}
await client.quit();
client.destroy();

View File

@@ -77,4 +77,4 @@ console.log('Count-Min Sketch info:');
// }
console.log(info);
await client.quit();
client.destroy();

View File

@@ -76,4 +76,4 @@ const info = await client.cf.info('mycuckoo');
// }
console.log(info);
await client.quit();
client.destroy();

View File

@@ -9,4 +9,4 @@ const serverTime = await client.time();
// 2022-02-25T12:57:40.000Z { microseconds: 351346 }
console.log(serverTime);
await client.quit();
client.destroy();

View File

@@ -48,4 +48,4 @@ try {
console.error(e);
}
await client.quit();
client.destroy();

View File

@@ -24,4 +24,4 @@ await client.connect();
await client.set('mykey', '5');
console.log(await client.mincr('mykey', 'myotherkey', 10)); // [ 15, 10 ]
await client.quit();
client.destroy();

View File

@@ -73,4 +73,4 @@ const numPets = await client.json.arrLen('noderedis:jsondata', '$.pets');
// We now have 4 pets.
console.log(`We now have ${numPets} pets.`);
await client.quit();
client.destroy();

View File

@@ -85,4 +85,4 @@ for (const doc of results.documents) {
console.log(`${doc.id}: ${doc.value.name}, ${doc.value.age} years old.`);
}
await client.quit();
client.destroy();

View File

@@ -145,4 +145,4 @@ console.log(
// ]
// }
await client.quit();
client.destroy();

View File

@@ -88,4 +88,4 @@ console.log(JSON.stringify(results, null, 2));
// }
// ]
// }
await client.quit();
client.destroy();

View File

@@ -12,4 +12,4 @@ for await (const member of client.sScanIterator(setName)) {
console.log(member);
}
await client.quit();
client.destroy();

View File

@@ -28,4 +28,4 @@ for await (const memberWithScore of client.zScanIterator('mysortedset')) {
console.log(memberWithScore);
}
await client.quit();
client.destroy();

View File

@@ -47,4 +47,4 @@ console.log(`Length of mystream: ${await client.xLen('mystream')}.`);
// Should be approximately 1000:
console.log(`Length of mytrimmedstream: ${await client.xLen('mytrimmedstream')}.`);
await client.quit();
client.destroy();

View File

@@ -119,4 +119,4 @@ try {
console.error(e);
}
await client.quit();
client.destroy();

View File

@@ -110,4 +110,4 @@ const [ simonCount, lanceCount ] = await client.topK.count('mytopk', [
console.log(`Count estimate for simon: ${simonCount}.`);
console.log(`Count estimate for lance: ${lanceCount}.`);
await client.quit();
client.destroy();

View File

@@ -37,4 +37,4 @@ console.log(responses);
// Clean up fixtures.
await client.del(['hash1', 'hash2', 'hash3']);
await client.quit();
client.destroy();