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

scp-cleanRedis

v0.1.4

Published

cleanRedis plugin for sdb-schedule framework

Downloads

16

Readme

Redis Date Clean

中文看这里

This Module is plugin for sdb-schedule, use auto clean redis data. sdb-schedule has APP sdb-schedule-ui. You can download it download

  • support regex
  • support ZSET,LIST clean

Setting

Install

step 1: install module

Using npm:

$ npm install scp-cleanRedis

step 2: config in sdb-schedule

  • Add Job, set Fun parame "scp-cleanRedis".

Changelog

0.1.3

Add Hash key clean. Del hash's filed by check the field's value.

0.0.2

Fix bug,only run once.

0.0.1

Implement it.

Config

Config file is json:

 {
	"redis":{ "host":"127.0.0.1","port":6379 },
	"keys":[
		{
			"name":"<descript info>",
			"type":"<zset|list|key|hash>",
			"match":"<redis keys synctax>",
			"action":{
				"style" : "<rank|score|rem|trim>",  // rank|score for ZSET;rem|trim for LIST
				"min"   : "<js expression>",
				"max"   : "<js expression>",
				"count" : "<js expression>", // optional ,FOR LIST rem
				"value" : "<js expression>", // optional ,FOR LIST rem
				"expire":36000,    // optional, for key type

				"regex":"<regex>",
				"attr":[
					{
						"matchType":"<int|string|dateStamp>",
						"min"    : "<val0 | js expression>",
						"max"    : "[val0 | js expression]"
					}
				]
			}
		}
	]
};

redis

Set redis Server Infomation:

  • host, redis Server IP
  • port, redis Server Port

keys

Array,clean redis key config。

  • name, descript info
  • type, clean type
    • zset, clear ZSET
    • list,clear LIST
    • key,clear redis key, set expire implement remove this key
    • hash,clear redis hash data's field, call hdel do it
  • match, find the matched redis key, see redis keys synctax
  • action, operation
    • style, operation method, support ( rank|score|rem|trim )。
      • rank, it's valid when type is ZSET , call zremrangebyrank
      • score,it's valid when type is ZSET , call zremrangebyscore
      • rem, it's valid when type is LIST , call lrem
      • trim, it's valid when type is LIST , call ltrim
    • min,js expression, the min value, use for ZSET and LIST's trim
    • max,js expression, the max value, use for ZSET and LIST's trim
    • count,js expression, the clean count, use for LIST's rem
    • value,js expression, the clean value, use for LIST's rem
    • expire, number( second ),it's valid when type is key, set key's expire
    • regex, the key's regex,support sub match
    • attr, sub match attribute
      • matchType, match type, support int,string,dateStramp
        • min, min Value
        • max, max value

Below is the configuration of detailed examples:

{
	"redis":{ "host":"127.0.0.1","port":6379 },
	"keys":[
		{
			"name":"清理zset类型",
			"type":"zset",
			"match":"*:Pool:his",
			"action":{
				"style" : "score",
				"min"   : "'-inf'",
				"max"   : "parseInt((new Date()).valueOf()/1000) - 86400 * 30",
				"regex":"([0-9]{8}):*",
				"attr":[
					{
						"matchType":"string",
						"min"    : "50901800",
						"max"    : ""
					}
				]
			}
		},
		{
			"name":"清理 List",
			"type":"list",
			"match":"brnn:winls",
			"action":{
				"style":"trim",
				"min"  : 0,
				"max"  : 3
			}
		},
		{
            "name":"清理Hash",
            "type":"hash",
            "match":"*:recy",
            "action":{
				"regex":"([0-9]{8})",
                "attr":[
                       {
                       "matchType":"dateStamp",
                       "min":"0",
                       "max":"(new Date()).valueOf() - 86400000 * 30"
                       }
                   ]
            }
        },
		{
			"name":"清理key",
			"type":"key",
			"match":"rcard:20??????:*:*",
			"action":{
				"expire":36000,
				"regex":"([0-9]{8}):([0-9]{1,}):([0-9]{1,})",
				"attr":[
					{
						"matchType":"dateStamp",
						"min"    : "0",
						"max"    : "(new Date()).valueOf() - 86400 * 30000"
					},
					{
						"matchType":"int",
						"min"    : "0",
						"max"    : "3"
					},
					{
						"matchType":"string",
						"min"    : "5",
						"max"    : ""
					}
				]
			}
		}
	]

};

Copyright and license

Copyright 2016+ shudingbo

Licensed under the [MIT License].