npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

redix-ex

v0.0.2

Published

Utility commands for redis

Downloads

3

Readme

redis-ex-cli

Redix-ex-cli is a utility command which manipulates multiple keys of Redis Database through command-line-interface.

You can pick up the keys with regular expression, rename / copy / delete them, or export the keys. Also set / delete one hash value for multiple keys at one time.

Install

$> npm -g install redis-ex-cli

How to use this?

At the first, you need to connect to your redis server.

$> redis-ex-cli

(disconnect)>> server localhost

localhost >>

Then select database index if you need.

localhost >> select 1

After that, list up the keys that you want.

localhost >> keys *

Quick Example

$> redis-ex-cli
(disconnect) >> server localhost

localhost >> select 1
select DB index : 1

localhost >> keys *
SESSION:1vIXgUzvFGtts3zFAAAA
SESSION:2Cy5087yyEjkgdhDAAAF
SESSION:rGPYg2paEG9YtZZFAAAA
SYSTEM:OAUTH2
logs:2014:1120:12-40-00
logs:2014:1120:23-04-38
logs:2014:1121:10-42-31
logs:2014:1121:10-42-34
logs:2014:1121:10-42-35

localhost >> keys del logs:2014:1121:*
[del]logs:2014:1121:10-42-31
[del]logs:2014:1121:10-42-34
[del]logs:2014:1121:10-42-35

Do you want to delete [N]/Y

Commands

quit

Quit from redis-ex-cli

server :host

Connect to the :host server with port 6379

(disconnect) >> server localhost
localhost >>

server :host :port

Connect to the :host server with the specified :port

(disconnect) >> server myhost.com 123456
myhost.com >>

select :index

Select the DB with having the specified zero-based numeric index. New connections always use DB 0

localhost >> select 1
select DB index : 1

keys :regexp

keys lists up the keys matched with :regexp.

localhost >> keys logs:2015:0404:1[7-8].*
logs:2015:0404:17-40-42
logs:2015:0404:17-41-55
logs:2015:0404:17-56-05
logs:2015:0404:18-01-36
logs:2015:0404:18-06-26
logs:2015:0404:18-11-17
logs:2015:0404:18-12-25
logs:2015:0404:18-13-17
logs:2015:0404:18-15-07

keys export :regexp

keys export generates the command sets that reproduce the keys matched with :regexp.

localhost >> keys export logs:2015:0404:1[7-8].*

keys export :regexp :filename

You may want to save paticular key-value pairs to a file.

localhost >> keys export logs:2015:0404:1[7-8].* 20150404-from17to18.log

keys import :filename

keys import loads the :filename, then executes the command lines one by one.

localhost >> keys import 20150404-from17to18.log

keys del :regexp

keys del deletes the keys that matched with :regexp.

localhost >> keys del logs:2015:0404:1[7-8].*


[del]logs:2015:0404:17-40-42
[del]logs:2015:0404:17-41-55
[del]logs:2015:0404:17-56-05
[del]logs:2015:0404:18-01-36
[del]logs:2015:0404:18-06-26
[del]logs:2015:0404:18-11-17
[del]logs:2015:0404:18-12-25
[del]logs:2015:0404:18-13-17
[del]logs:2015:0404:18-15-07

Do you want to delete [N]/Y

keys copy :regexp :newkey

keys copy copies the keys that matched with :regexp to :newkey You can use regular expression to the :newkey value with grouping.

localhost >> keys copy logs:2015:04* logs:test:

[copy]logs:2015:0401:06-59-46 --> logs:test:01:06-59-46
[copy]logs:2015:0406:07-09-22 --> logs:test:06:07-09-22
[copy]logs:2015:0401:07-11-43 --> logs:test:01:07-11-43
[copy]logs:2015:0401:07-12-36 --> logs:test:01:07-12-36

Do you want to copy [N]/Y

keys rename :regexp :replace

keys rename renames the keys that matched with :regexp to :replace You can use regular expression to the :replace value with grouping.

localhost >> keys rename logs:2014:04(.*) logs:2015:05$1:test

[rename]logs:2014:0401:06-59-46 --> logs:2015:0501:06-59-46:test
[rename]logs:2014:0401:07-11-43 --> logs:2015:0501:07-11-43:test
[rename]logs:2014:0401:07-12-36 --> logs:2015:0501:07-12-36:test

Do you want to rename [N]/Y

keys hset :regexp :field :value

keys hset sets the :value to the :field that matched with :regexp

localhost >>keys hset logs:2015:04* isTest true

[hset]logs:2015:0401:06-59-46
[hset]logs:2015:0401:07-01-02
[hset]logs:2015:0401:07-11-43
[hset]logs:2015:0401:07-12-36

Do you want to set values [N]/Y

keys hdel :regexp :field

keys hdel deletes the :field from the keys that matched with :regexp.

localhost >>keys hdel logs:* isTest

[hdel]logs:2015:0401:06-59-46
[hdel]logs:2015:0401:07-01-02
[hdel]logs:2015:0401:07-11-43
[hdel]logs:2015:0401:07-12-36

Do you want to delete [N]/Y

keys hsearch :regexp :field :value

keys hsearch find the keys that have the :field contains :value. You can specify the :value with regular expression.

For example, if you want to find the keys that the phone number stated with 310-:

localhost >>keys hsearch logs:2015:04* sendto ^310\-.*

logs:2015:0401:13-45-17
logs:2015:0401:15-02-59
logs:2015:0402:14-09-03
logs:2015:0404:15-20-56
logs:2015:0404:17-41-55
logs:2015:0404:17-56-05
logs:2015:0405:11-32-43
logs:2015:0405:14-50-55
logs:2015:0405:14-54-07