redis_scanner 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/CHANGELOG.md +8 -0
- data/LICENSE +22 -0
- data/README.md +5 -1
- data/lib/redis_scanner/engine.rb +2 -1
- data/lib/redis_scanner/formatter.rb +2 -0
- data/lib/redis_scanner/pattern.rb +2 -0
- data/lib/redis_scanner/redis.rb +2 -0
- data/lib/redis_scanner/rule.rb +18 -0
- data/lib/redis_scanner/version.rb +3 -1
- data/lib/redis_scanner.rb +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cff13d7534968118b1c45c3b19cfb2dd9c0f95d
|
4
|
+
data.tar.gz: 6f43165047395b2cc641110553accbb283f81051
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 646c29ca228ec13e168d00ce4b20499f803772d199b3858e6ed13cbcd2188e8648b47ead4584cb04dd06bacf12d137a6b8f7f2d9b4ebb93df06d3af3073028ff
|
7
|
+
data.tar.gz: 9295e780f4749c1b4f776cf9c52aa87223ba888e1890f895eafc4fd6a10295580714b8b1a74c262f8b2345adc677b526da89a042d153f42e043b7c7772aab283
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2016 Vincent Xie
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
# RedisScanner
|
1
|
+
# RedisScanner [![Build Status][travis-image]][travis-link]
|
2
|
+
|
3
|
+
[travis-image]: https://travis-ci.org/xiewenwei/redis_scanner.svg?branch=master
|
4
|
+
[travis-link]: http://travis-ci.org/xiewenwei/redis_scanner
|
5
|
+
[travis-home]: http://travis-ci.org/
|
2
6
|
|
3
7
|
RedisScanner is a tiny tool for scanning all redis keys and creating statistic result. The features are the followings.
|
4
8
|
|
data/lib/redis_scanner/engine.rb
CHANGED
data/lib/redis_scanner/redis.rb
CHANGED
data/lib/redis_scanner/rule.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
|
1
3
|
module RedisScanner
|
2
4
|
class Rule
|
3
5
|
PRESET_RULES = [
|
@@ -14,6 +16,7 @@ module RedisScanner
|
|
14
16
|
end
|
15
17
|
|
16
18
|
def extract_pattern(key)
|
19
|
+
key = force_valid_key(key)
|
17
20
|
@rules.each do |rule, replacer|
|
18
21
|
if m = rule.match(key)
|
19
22
|
key = key.sub(m[1], replacer)
|
@@ -22,5 +25,20 @@ module RedisScanner
|
|
22
25
|
end
|
23
26
|
key
|
24
27
|
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def force_valid_key(key)
|
32
|
+
if key.valid_encoding?
|
33
|
+
key
|
34
|
+
else
|
35
|
+
key.size.times do |index|
|
36
|
+
unless key[index].valid_encoding?
|
37
|
+
key[index] = "?"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
key
|
41
|
+
end
|
42
|
+
end
|
25
43
|
end
|
26
44
|
end
|
data/lib/redis_scanner.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis_scanner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Xie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -109,6 +109,7 @@ files:
|
|
109
109
|
- CHANGELOG.md
|
110
110
|
- CODE_OF_CONDUCT.md
|
111
111
|
- Gemfile
|
112
|
+
- LICENSE
|
112
113
|
- README.md
|
113
114
|
- Rakefile
|
114
115
|
- bin/redis_scanner
|