kredis-query 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rubocop.yml +17 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +204 -0
- data/LICENSE.txt +21 -0
- data/README.md +33 -0
- data/Rakefile +16 -0
- data/lib/kredis/query/search.rb +17 -0
- data/lib/kredis/query/version.rb +5 -0
- data/lib/kredis/query.rb +12 -0
- data/sig/kredis/query.rbs +6 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f9b2b3a572cf5d60fd28d5228e1836277b9b71122c4ae2199c42ffe398087eb3
|
4
|
+
data.tar.gz: 5b6af22e8672f52a4a9d4755a516f0f1fb1f5ea1a9eed6ff9463b35159054aef
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e1257d4765e9ceddd8cd626ee9656fb5c3ad0ea3f55fd92e10c3c6779f930c6684998bfc4d49cd0215112be2286d9be14e9916d35cb67c9f6c2826b06dc61565
|
7
|
+
data.tar.gz: 137c29e9d7968ebca48a12fff4b2e00b20ff7213f2e683b12b8657f69d7c78033cbf743de759b69a6eac5940141bdb3daf555dbe05bf4fcc3cb7a78273f0af20
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.7
|
3
|
+
NewCops: enable
|
4
|
+
|
5
|
+
Style/StringLiterals:
|
6
|
+
Enabled: true
|
7
|
+
EnforcedStyle: double_quotes
|
8
|
+
|
9
|
+
Style/StringLiteralsInInterpolation:
|
10
|
+
Enabled: true
|
11
|
+
EnforcedStyle: double_quotes
|
12
|
+
|
13
|
+
Style/Documentation:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Layout/LineLength:
|
17
|
+
Max: 120
|
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in kredis-query.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem "rake", "~> 13.0"
|
9
|
+
gem "kredis","~> 1.0.0"
|
10
|
+
gem "pry"
|
11
|
+
|
12
|
+
gem "minitest", "~> 5.0"
|
13
|
+
|
14
|
+
gem "rubocop", "~> 1.21"
|
15
|
+
gem "rubocop-minitest"
|
16
|
+
gem "rubocop-rake"
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,204 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
kredis-query (0.1.3)
|
5
|
+
activesupport (>= 6.0.0)
|
6
|
+
kredis (~> 1.0.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actioncable (7.0.3)
|
12
|
+
actionpack (= 7.0.3)
|
13
|
+
activesupport (= 7.0.3)
|
14
|
+
nio4r (~> 2.0)
|
15
|
+
websocket-driver (>= 0.6.1)
|
16
|
+
actionmailbox (7.0.3)
|
17
|
+
actionpack (= 7.0.3)
|
18
|
+
activejob (= 7.0.3)
|
19
|
+
activerecord (= 7.0.3)
|
20
|
+
activestorage (= 7.0.3)
|
21
|
+
activesupport (= 7.0.3)
|
22
|
+
mail (>= 2.7.1)
|
23
|
+
net-imap
|
24
|
+
net-pop
|
25
|
+
net-smtp
|
26
|
+
actionmailer (7.0.3)
|
27
|
+
actionpack (= 7.0.3)
|
28
|
+
actionview (= 7.0.3)
|
29
|
+
activejob (= 7.0.3)
|
30
|
+
activesupport (= 7.0.3)
|
31
|
+
mail (~> 2.5, >= 2.5.4)
|
32
|
+
net-imap
|
33
|
+
net-pop
|
34
|
+
net-smtp
|
35
|
+
rails-dom-testing (~> 2.0)
|
36
|
+
actionpack (7.0.3)
|
37
|
+
actionview (= 7.0.3)
|
38
|
+
activesupport (= 7.0.3)
|
39
|
+
rack (~> 2.0, >= 2.2.0)
|
40
|
+
rack-test (>= 0.6.3)
|
41
|
+
rails-dom-testing (~> 2.0)
|
42
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
43
|
+
actiontext (7.0.3)
|
44
|
+
actionpack (= 7.0.3)
|
45
|
+
activerecord (= 7.0.3)
|
46
|
+
activestorage (= 7.0.3)
|
47
|
+
activesupport (= 7.0.3)
|
48
|
+
globalid (>= 0.6.0)
|
49
|
+
nokogiri (>= 1.8.5)
|
50
|
+
actionview (7.0.3)
|
51
|
+
activesupport (= 7.0.3)
|
52
|
+
builder (~> 3.1)
|
53
|
+
erubi (~> 1.4)
|
54
|
+
rails-dom-testing (~> 2.0)
|
55
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
56
|
+
activejob (7.0.3)
|
57
|
+
activesupport (= 7.0.3)
|
58
|
+
globalid (>= 0.3.6)
|
59
|
+
activemodel (7.0.3)
|
60
|
+
activesupport (= 7.0.3)
|
61
|
+
activerecord (7.0.3)
|
62
|
+
activemodel (= 7.0.3)
|
63
|
+
activesupport (= 7.0.3)
|
64
|
+
activestorage (7.0.3)
|
65
|
+
actionpack (= 7.0.3)
|
66
|
+
activejob (= 7.0.3)
|
67
|
+
activerecord (= 7.0.3)
|
68
|
+
activesupport (= 7.0.3)
|
69
|
+
marcel (~> 1.0)
|
70
|
+
mini_mime (>= 1.1.0)
|
71
|
+
activesupport (7.0.3)
|
72
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
73
|
+
i18n (>= 1.6, < 2)
|
74
|
+
minitest (>= 5.1)
|
75
|
+
tzinfo (~> 2.0)
|
76
|
+
ast (2.4.2)
|
77
|
+
builder (3.2.4)
|
78
|
+
coderay (1.1.3)
|
79
|
+
concurrent-ruby (1.1.10)
|
80
|
+
crass (1.0.6)
|
81
|
+
digest (3.1.0)
|
82
|
+
erubi (1.10.0)
|
83
|
+
globalid (1.0.0)
|
84
|
+
activesupport (>= 5.0)
|
85
|
+
i18n (1.10.0)
|
86
|
+
concurrent-ruby (~> 1.0)
|
87
|
+
kredis (1.0.1)
|
88
|
+
activesupport (>= 6.0.0)
|
89
|
+
redis (~> 4.2)
|
90
|
+
loofah (2.18.0)
|
91
|
+
crass (~> 1.0.2)
|
92
|
+
nokogiri (>= 1.5.9)
|
93
|
+
mail (2.7.1)
|
94
|
+
mini_mime (>= 0.1.1)
|
95
|
+
marcel (1.0.2)
|
96
|
+
method_source (1.0.0)
|
97
|
+
mini_mime (1.1.2)
|
98
|
+
mini_portile2 (2.8.0)
|
99
|
+
minitest (5.15.0)
|
100
|
+
net-imap (0.2.3)
|
101
|
+
digest
|
102
|
+
net-protocol
|
103
|
+
strscan
|
104
|
+
net-pop (0.1.1)
|
105
|
+
digest
|
106
|
+
net-protocol
|
107
|
+
timeout
|
108
|
+
net-protocol (0.1.3)
|
109
|
+
timeout
|
110
|
+
net-smtp (0.3.1)
|
111
|
+
digest
|
112
|
+
net-protocol
|
113
|
+
timeout
|
114
|
+
nio4r (2.5.8)
|
115
|
+
nokogiri (1.13.6)
|
116
|
+
mini_portile2 (~> 2.8.0)
|
117
|
+
racc (~> 1.4)
|
118
|
+
nokogiri (1.13.6-x86_64-linux)
|
119
|
+
racc (~> 1.4)
|
120
|
+
parallel (1.22.1)
|
121
|
+
parser (3.1.2.0)
|
122
|
+
ast (~> 2.4.1)
|
123
|
+
pry (0.14.1)
|
124
|
+
coderay (~> 1.1)
|
125
|
+
method_source (~> 1.0)
|
126
|
+
racc (1.6.0)
|
127
|
+
rack (2.2.3.1)
|
128
|
+
rack-test (1.1.0)
|
129
|
+
rack (>= 1.0, < 3)
|
130
|
+
rails (7.0.3)
|
131
|
+
actioncable (= 7.0.3)
|
132
|
+
actionmailbox (= 7.0.3)
|
133
|
+
actionmailer (= 7.0.3)
|
134
|
+
actionpack (= 7.0.3)
|
135
|
+
actiontext (= 7.0.3)
|
136
|
+
actionview (= 7.0.3)
|
137
|
+
activejob (= 7.0.3)
|
138
|
+
activemodel (= 7.0.3)
|
139
|
+
activerecord (= 7.0.3)
|
140
|
+
activestorage (= 7.0.3)
|
141
|
+
activesupport (= 7.0.3)
|
142
|
+
bundler (>= 1.15.0)
|
143
|
+
railties (= 7.0.3)
|
144
|
+
rails-dom-testing (2.0.3)
|
145
|
+
activesupport (>= 4.2.0)
|
146
|
+
nokogiri (>= 1.6)
|
147
|
+
rails-html-sanitizer (1.4.3)
|
148
|
+
loofah (~> 2.3)
|
149
|
+
railties (7.0.3)
|
150
|
+
actionpack (= 7.0.3)
|
151
|
+
activesupport (= 7.0.3)
|
152
|
+
method_source
|
153
|
+
rake (>= 12.2)
|
154
|
+
thor (~> 1.0)
|
155
|
+
zeitwerk (~> 2.5)
|
156
|
+
rainbow (3.1.1)
|
157
|
+
rake (13.0.6)
|
158
|
+
redis (4.6.0)
|
159
|
+
regexp_parser (2.5.0)
|
160
|
+
rexml (3.2.5)
|
161
|
+
rubocop (1.30.1)
|
162
|
+
parallel (~> 1.10)
|
163
|
+
parser (>= 3.1.0.0)
|
164
|
+
rainbow (>= 2.2.2, < 4.0)
|
165
|
+
regexp_parser (>= 1.8, < 3.0)
|
166
|
+
rexml (>= 3.2.5, < 4.0)
|
167
|
+
rubocop-ast (>= 1.18.0, < 2.0)
|
168
|
+
ruby-progressbar (~> 1.7)
|
169
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
170
|
+
rubocop-ast (1.18.0)
|
171
|
+
parser (>= 3.1.1.0)
|
172
|
+
rubocop-minitest (0.20.0)
|
173
|
+
rubocop (>= 0.90, < 2.0)
|
174
|
+
rubocop-rake (0.6.0)
|
175
|
+
rubocop (~> 1.0)
|
176
|
+
ruby-progressbar (1.11.0)
|
177
|
+
strscan (3.0.3)
|
178
|
+
thor (1.2.1)
|
179
|
+
timeout (0.3.0)
|
180
|
+
tzinfo (2.0.4)
|
181
|
+
concurrent-ruby (~> 1.0)
|
182
|
+
unicode-display_width (2.1.0)
|
183
|
+
websocket-driver (0.7.5)
|
184
|
+
websocket-extensions (>= 0.1.0)
|
185
|
+
websocket-extensions (0.1.5)
|
186
|
+
zeitwerk (2.5.4)
|
187
|
+
|
188
|
+
PLATFORMS
|
189
|
+
ruby
|
190
|
+
x86_64-linux
|
191
|
+
|
192
|
+
DEPENDENCIES
|
193
|
+
kredis (~> 1.0.0)
|
194
|
+
kredis-query!
|
195
|
+
minitest (~> 5.0)
|
196
|
+
pry
|
197
|
+
rails (>= 6.0.0)
|
198
|
+
rake (~> 13.0)
|
199
|
+
rubocop (~> 1.21)
|
200
|
+
rubocop-minitest
|
201
|
+
rubocop-rake
|
202
|
+
|
203
|
+
BUNDLED WITH
|
204
|
+
2.3.12
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2022 Loran Kloeze
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Kredis Query 🔍🔎
|
2
|
+
A plugin for Kredis that adds querying functionality.
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
Make sure you have a `gem "kredis"` entry in your Gemfile.
|
6
|
+
|
7
|
+
Now add `kredis-query` to your Gemfile:
|
8
|
+
```ruby
|
9
|
+
gem "kredis-query"
|
10
|
+
```
|
11
|
+
Run `bundle install`.
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
# Returns the search results in batches of *approximately* 1.000 keys
|
17
|
+
Kredis.search('user_names:*') do |key_batch|
|
18
|
+
key_batch == [ 'user_names:1', 'user_names:2', ... ]
|
19
|
+
end
|
20
|
+
|
21
|
+
# Optionally you can change the batch size hint. Since it's a hint,
|
22
|
+
# there is no guarantee the size of each batch matches the hint.
|
23
|
+
# Check https://redis.io/commands/scan/#the-count-option for more info.
|
24
|
+
#
|
25
|
+
# Returns the search results in batches of *approximately* 750 keys
|
26
|
+
Kredis.search('user_names:*', batch_size: 750) { ... }
|
27
|
+
|
28
|
+
# Using a different than the default `shared` redis instance, relying on `config/redis/secondary.yml`:
|
29
|
+
Kredis.search('user_names:*', config: :secondary) { ... }
|
30
|
+
```
|
31
|
+
|
32
|
+
## Development
|
33
|
+
As you can see, this gem is in its very early stages. Feel free to create an issue or a PR to improve or enhance functionality! 🙂
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
5
|
+
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
7
|
+
t.libs << "test"
|
8
|
+
t.libs << "lib"
|
9
|
+
t.test_files = FileList["test/**/test_*.rb"]
|
10
|
+
end
|
11
|
+
|
12
|
+
require "rubocop/rake_task"
|
13
|
+
|
14
|
+
RuboCop::RakeTask.new
|
15
|
+
|
16
|
+
task default: %i[test rubocop]
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kredis
|
4
|
+
module Query
|
5
|
+
module Search
|
6
|
+
def search(key_pattern, batch_size: 1000, config: :shared)
|
7
|
+
pattern = namespace ? "#{namespace}:#{key_pattern}" : key_pattern
|
8
|
+
cursor = "0"
|
9
|
+
loop do
|
10
|
+
cursor, keys = redis(config: config).scan(cursor, match: pattern, count: batch_size)
|
11
|
+
redis.multi { |pipeline| yield keys, pipeline }
|
12
|
+
break if cursor == "0"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/kredis/query.rb
ADDED
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kredis-query
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Loran Kloeze
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-06-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 6.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 6.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: kredis
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.0.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.0.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 6.0.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 6.0.0
|
55
|
+
description: Kredis plugin for querying keys
|
56
|
+
email:
|
57
|
+
- loran@codedivision.nl
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".rubocop.yml"
|
63
|
+
- Gemfile
|
64
|
+
- Gemfile.lock
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- lib/kredis/query.rb
|
69
|
+
- lib/kredis/query/search.rb
|
70
|
+
- lib/kredis/query/version.rb
|
71
|
+
- sig/kredis/query.rbs
|
72
|
+
homepage: https://github.com/LoranKloeze/kredis-query
|
73
|
+
licenses:
|
74
|
+
- MIT
|
75
|
+
metadata:
|
76
|
+
homepage_uri: https://github.com/LoranKloeze/kredis-query
|
77
|
+
source_code_uri: https://github.com/LoranKloeze/kredis-query
|
78
|
+
changelog_uri: https://github.com/LoranKloeze/kredis-query
|
79
|
+
rubygems_mfa_required: 'true'
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 2.7.0
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
requirements: []
|
95
|
+
rubygems_version: 3.1.2
|
96
|
+
signing_key:
|
97
|
+
specification_version: 4
|
98
|
+
summary: Kredis plugin for querying keys
|
99
|
+
test_files: []
|