redis-utils-cli
Advanced tools
Comparing version 1.0.3 to 1.0.4
{ | ||
"name": "redis-utils-cli", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Simple command line tools for Redis", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
105
README.md
@@ -1,5 +0,5 @@ | ||
redis-utils | ||
============ | ||
Redis Utilities | ||
=============== | ||
A Node.js command line interface (CLI) for performing pattern based Redis functions | ||
A Node.js based command line interface (CLI) for performing pattern based Redis functions | ||
@@ -10,51 +10,94 @@ ## Installation | ||
## Usage | ||
To copy all keys matching the pattern 'users:*' | ||
## Commands | ||
$ redis-utils copy <source> <destination> -p users:* | ||
**Copy** | ||
Copy keys from one Redis instance to another | ||
Arguments: | ||
**Arguments** | ||
<source> The address for the source Redis database (follows this format: [auth@]<hostname>[:port][/db] ) | ||
<destination> The address for the destination Redis database (follows this format: [auth@]<hostname>[:port][/db] ) | ||
- \<source\> The address for the source Redis database (follows this format: [auth@]\<hostname\>[:port][/db] ) | ||
- \<destination\> The address for the destination Redis database (follows this format: [auth@]\<hostname\>[:port][/db] ) | ||
Options include: | ||
**Options include** | ||
-p <pattern> (Key pattern. Default: *) | ||
-o (Overwrite. Default: *) | ||
-m <mode> (Hash overwrite mode (key|field). Default: key) | ||
- -p \<pattern\> (Key pattern. Default: *) | ||
- -o (Overwrite. Default (when omitted): false) | ||
- -m \<mode\> (Hash overwrite mode (key|field). Default: key) | ||
--- | ||
To delete all keys matching the pattern 'users:*' | ||
**Delete** | ||
Delete keys from a Redis instance. | ||
$ redis-utils del <redis> users:* | ||
**Arguments** | ||
Arguments: | ||
- \<redis\> The address for the Redis database (follows this format: [auth@]\<hostname\>[:port][/db] ) | ||
- \<pattern\> The key pattern. (Default: *) | ||
<redis> The address for the Redis database (follows this format: [auth@]<hostname>[:port][/db] ) | ||
<pattern> The key pattern. (Default: *) | ||
--- | ||
**List** | ||
List all keys and hash fields that match a specified pattern. | ||
To count all keys matching the pattern 'users:*' | ||
**Arguments** | ||
$ redis-utils count <redis> users:* | ||
- \<redis\> The address for the Redis database (follows this format: [auth@]\<hostname\>[:port][/db] ) | ||
- \<pattern\> The key pattern. (Default: *) | ||
Arguments: | ||
--- | ||
<redis> The address for the Redis database (follows this format: [auth@]<hostname>[:port][/db] ) | ||
<pattern> The key pattern. (Default: *) | ||
**Count** | ||
Display a numeric count of all keys that match a specified pattern. | ||
**Arguments** | ||
To list all keys matching the pattern 'users:*' | ||
- \<redis\> The address for the Redis database (follows this format: [auth@]\<hostname\>[:port][/db] ) | ||
- \<pattern\> The key pattern. (Default: *) | ||
$ redis-utils list <redis> users:* | ||
Arguments: | ||
## Supported Glob-Style Patterns | ||
<redis> The address for the Redis database (follows this format: [auth@]<hostname>[:port][/db] ) | ||
<pattern> The key pattern. (Default: *) | ||
- `h?llo` matches hello, hallo and hxllo | ||
- `h*llo` matches hllo and heeeello | ||
- `h[ae]llo` matches hello and hallo, but not hillo | ||
- `h[^e]llo` matches hallo, hbllo, ... but not hello | ||
- `h[a-b]llo` matches hallo and hbllo | ||
Use \ to escape special characters if you want to match them verbatim. | ||
(basically, what you are already familiar with using Redis) | ||
## Examples | ||
$ redis-utils copy someauth@10.2.1.44/0 127.0.0.1/0 -p users:* | ||
Copies all keys matching the pattern `users:*` from `10.2.1.44, db: 0` into `127.0.0.1, db: 0` | ||
(Because `-o` was not included, it would only copy data if the keys do not exist in destination) | ||
For hashes, if you want to copy data based on the existence of hash fields instead of keys, use the `-m field` option. | ||
<br> | ||
$ redis-utils del 127.0.0.1 users:* | ||
Deletes all keys matching the pattern `users:*` from `127.0.0.1, db: 0` | ||
<br> | ||
$ redis-utils list 127.0.0.1 users:* | ||
Displays in the terminal, all keys (with some additional details) matching the pattern `users:*` from `127.0.0.1, db: 0` | ||
<br> | ||
$ redis-utils count 127.0.0.1 users:* | ||
Displays in the terminal, a numeric count of all keys matching the pattern `users:*` from `127.0.0.1, db: 0` | ||
<br> | ||
## IMPORTANT NOTE | ||
@@ -66,3 +109,3 @@ | ||
See http://redis.io/commands/keys for more information. | ||
Read the [Redis Documentation](http://redis.io/commands/keys) for more information. | ||
@@ -92,2 +135,2 @@ ## License | ||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
37352
134