1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00

Merge branch 'master' of github.com:redis/node-redis into v5

This commit is contained in:
Leibale
2023-09-05 14:39:57 -04:00
5 changed files with 3905 additions and 560 deletions

35
LICENSE
View File

@@ -1,24 +1,21 @@
MIT License MIT License
Copyright (c) 2016-present Node Redis contributors. Copyright (c) 2022-2023, Redis, inc.
Permission is hereby granted, free of charge, to any person Permission is hereby granted, free of charge, to any person obtaining a copy
obtaining a copy of this software and associated documentation of this software and associated documentation files (the "Software"), to deal
files (the "Software"), to deal in the Software without in the Software without restriction, including without limitation the rights
restriction, including without limitation the rights to use, to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
copies of the Software, and to permit persons to whom the furnished to do so, subject to the following conditions:
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be The above copyright notice and this permission notice shall be included in all
included in all copies or substantial portions of the Software. copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR SOFTWARE.
OTHER DEALINGS IN THE SOFTWARE.

4418
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -439,7 +439,7 @@ export default class RedisClient<
.on('end', () => this.emit('end')); .on('end', () => this.emit('end'));
} }
private _pingTimer?: NodeJS.Timer; private _pingTimer?: NodeJS.Timeout;
private _setPingTimer(): void { private _setPingTimer(): void {
if (!this._options?.pingInterval || !this._socket.isReady) return; if (!this._options?.pingInterval || !this._socket.isReady) return;

View File

@@ -12,7 +12,7 @@ For complete examples, see [`search-hashes.js`](https://github.com/redis/node-re
#### Creating an Index #### Creating an Index
Before we can perform any searches, we need to tell RediSearch how to index our data, and which Redis keys to find that data in. The [FT.CREATE](https://oss.redis.com/redisearch/Commands/#ftcreate) command creates a RediSearch index. Here's how to use it to create an index we'll call `idx:animals` where we want to index hashes containing `name`, `species` and `age` fields, and whose key names in Redis begin with the prefix `noderedis:animals`: Before we can perform any searches, we need to tell RediSearch how to index our data, and which Redis keys to find that data in. The [FT.CREATE](https://redis.io/commands/ft.create) command creates a RediSearch index. Here's how to use it to create an index we'll call `idx:animals` where we want to index hashes containing `name`, `species` and `age` fields, and whose key names in Redis begin with the prefix `noderedis:animals`:
```javascript ```javascript
await client.ft.create('idx:animals', { await client.ft.create('idx:animals', {
@@ -28,11 +28,11 @@ await client.ft.create('idx:animals', {
}); });
``` ```
See the [`FT.CREATE` documentation](https://oss.redis.com/redisearch/Commands/#ftcreate) for information about the different field types and additional options. See the [`FT.CREATE` documentation](https://redis.io/commands/ft.create/#description) for information about the different field types and additional options.
#### Querying the Index #### Querying the Index
Once we've created an index, and added some data to Redis hashes whose keys begin with the prefix `noderedis:animals`, we can start writing some search queries. RediSearch supports a rich query syntax for full-text search, faceted search, aggregation and more. Check out the [`FT.SEARCH` documentation](https://oss.redis.com/redisearch/Commands/#ftsearch) and the [query syntax reference](https://oss.redis.com/redisearch/Query_Syntax/) for more information. Once we've created an index, and added some data to Redis hashes whose keys begin with the prefix `noderedis:animals`, we can start writing some search queries. RediSearch supports a rich query syntax for full-text search, faceted search, aggregation and more. Check out the [`FT.SEARCH` documentation](https://redis.io/commands/ft.search) and the [query syntax reference](https://redis.io/docs/interact/search-and-query/query) for more information.
Let's write a query to find all the animals where the `species` field has the value `dog`: Let's write a query to find all the animals where the `species` field has the value `dog`:
@@ -112,7 +112,7 @@ Note that we're using JSON Path to specify where the fields to index are in our
Now we have an index and some data stored as JSON documents in Redis (see the [JSON package documentation](https://github.com/redis/node-redis/tree/master/packages/json) for examples of how to store JSON), we can write some queries... Now we have an index and some data stored as JSON documents in Redis (see the [JSON package documentation](https://github.com/redis/node-redis/tree/master/packages/json) for examples of how to store JSON), we can write some queries...
We'll use the [RediSearch query language](https://oss.redis.com/redisearch/Query_Syntax/) and [`FT.SEARCH`](https://oss.redis.com/redisearch/Commands/#ftsearch) command. Here's a query to find users under the age of 30: We'll use the [RediSearch query language](https://redis.io/docs/interact/search-and-query/query) and [`FT.SEARCH`](https://redis.io/commands/ft.search) command. Here's a query to find users under the age of 30:
```javascript ```javascript
await client.ft.search('idx:users', '@age:[0 30]'); await client.ft.search('idx:users', '@age:[0 30]');

View File

@@ -1,6 +1,6 @@
{ {
"name": "@redis/time-series", "name": "@redis/time-series",
"version": "1.0.4", "version": "1.0.5",
"license": "MIT", "license": "MIT",
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",