protocol-redis 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/protocol/redis/methods/cluster.rb +23 -23
- data/lib/protocol/redis/methods/hashes.rb +16 -3
- data/lib/protocol/redis/methods/server.rb +17 -1
- data/lib/protocol/redis/version.rb +2 -2
- data/license.md +1 -1
- data/readme.md +8 -0
- data.tar.gz.sig +0 -0
- metadata +6 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4eaf2e185b9e0b2f5a29527a83e803e56bd89470ebbd800519338db47c33ae8
|
4
|
+
data.tar.gz: 6954fa6365d178dca0ff302b5b1739e9d731dd72df61a9238f6d16a152640318
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d85825ba053ca54ae00e329edef4ae7bcb0b06afc5c3752d777faa20439fff39d0a4bf9cd293f675a36859b5bb7fa8417c449fc6efe3fa0664892ad8f7b7593e
|
7
|
+
data.tar.gz: 503526c37e829a7272c0a43c458f514544d9b1514410f957c1b8ef669bab5701c0a892143cd9c4f83b9e3186551e6a7be135f6b8d087fc4d223cbb1e39571a60
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -4,27 +4,27 @@
|
|
4
4
|
# Copyright, 2023, by Nick Burwell.
|
5
5
|
|
6
6
|
module Protocol
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
7
|
+
module Redis
|
8
|
+
module Methods
|
9
|
+
module Cluster
|
10
|
+
# Sends the `CLUSTER *` command to random node and returns its reply.
|
11
|
+
# @see https://redis.io/commands/cluster-addslots/
|
12
|
+
# @param subcommand [String, Symbol] the subcommand of cluster command
|
13
|
+
# e.g. `:addslots`, `:delslots`, `:nodes`, `:replicas`, `:info`
|
14
|
+
#
|
15
|
+
# @return [Object] depends on the subcommand provided
|
16
|
+
def cluster(subcommand, *args)
|
17
|
+
call("CLUSTER", subcommand.to_s, *args)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Sends `ASKING` command to random node and returns its reply.
|
21
|
+
# @see https://redis.io/commands/asking/
|
22
|
+
#
|
23
|
+
# @return [String] `'OK'`
|
24
|
+
def asking
|
25
|
+
call("ASKING")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
30
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2019-
|
4
|
+
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
# Copyright, 2023, by Troex Nevelin.
|
6
6
|
# Copyright, 2023, by Nick Burwell.
|
7
7
|
|
@@ -158,8 +158,8 @@ module Protocol
|
|
158
158
|
# @see https://redis.io/commands/hscan/
|
159
159
|
# @param cursor [Cursor]
|
160
160
|
# @return [Hash]
|
161
|
-
def hscan(cursor, match: nil, count: nil)
|
162
|
-
arguments = [cursor]
|
161
|
+
def hscan(key, cursor = "0", match: nil, count: nil)
|
162
|
+
arguments = [key, cursor]
|
163
163
|
|
164
164
|
if match
|
165
165
|
arguments.append("MATCH", match)
|
@@ -171,6 +171,19 @@ module Protocol
|
|
171
171
|
|
172
172
|
call("HSCAN", *arguments)
|
173
173
|
end
|
174
|
+
|
175
|
+
# Iterate over each field and the value of the hash, using HSCAN.
|
176
|
+
def hscan_each(key, cursor = "0", match: nil, count: nil, &block)
|
177
|
+
return enum_for(:hscan_each, key, cursor, match: match, count: count) unless block_given?
|
178
|
+
|
179
|
+
while true
|
180
|
+
cursor, data = hscan(key, cursor, match: match, count: count)
|
181
|
+
|
182
|
+
data.each_slice(2, &block)
|
183
|
+
|
184
|
+
break if cursor == "0"
|
185
|
+
end
|
186
|
+
end
|
174
187
|
end
|
175
188
|
end
|
176
189
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2019-
|
4
|
+
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
# Copyright, 2020, by David Ortiz.
|
6
6
|
|
7
7
|
module Protocol
|
@@ -25,6 +25,22 @@ module Protocol
|
|
25
25
|
return metadata
|
26
26
|
end
|
27
27
|
|
28
|
+
def client_info
|
29
|
+
metadata = {}
|
30
|
+
|
31
|
+
call('CLIENT', 'INFO').split(/\s+/).each do |pair|
|
32
|
+
key, value = pair.split('=')
|
33
|
+
|
34
|
+
if value
|
35
|
+
metadata[key.to_sym] = value
|
36
|
+
else
|
37
|
+
metadata[key.to_sym] = nil
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
return metadata
|
42
|
+
end
|
43
|
+
|
28
44
|
# Remove all keys from the current database.
|
29
45
|
# @see https://redis.io/commands/flushdb
|
30
46
|
# @param async [Enum]
|
data/license.md
CHANGED
data/readme.md
CHANGED
@@ -48,3 +48,11 @@ We welcome contributions to this project.
|
|
48
48
|
3. Commit your changes (`git commit -am 'Add some feature'`).
|
49
49
|
4. Push to the branch (`git push origin my-new-feature`).
|
50
50
|
5. Create new Pull Request.
|
51
|
+
|
52
|
+
### Developer Certificate of Origin
|
53
|
+
|
54
|
+
In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
|
55
|
+
|
56
|
+
### Community Guidelines
|
57
|
+
|
58
|
+
This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protocol-redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -45,7 +45,7 @@ cert_chain:
|
|
45
45
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
46
46
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
47
47
|
-----END CERTIFICATE-----
|
48
|
-
date:
|
48
|
+
date: 2024-08-15 00:00:00.000000000 Z
|
49
49
|
dependencies: []
|
50
50
|
description:
|
51
51
|
email:
|
@@ -78,7 +78,9 @@ homepage: https://github.com/socketry/protocol-redis
|
|
78
78
|
licenses:
|
79
79
|
- MIT
|
80
80
|
metadata:
|
81
|
+
documentation_uri: https://socketry.github.io/protocol-redis/
|
81
82
|
funding_uri: https://github.com/sponsors/ioquatix
|
83
|
+
source_code_uri: https://github.com/socketry/protocol-redis.git
|
82
84
|
post_install_message:
|
83
85
|
rdoc_options: []
|
84
86
|
require_paths:
|
@@ -87,14 +89,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
87
89
|
requirements:
|
88
90
|
- - ">="
|
89
91
|
- !ruby/object:Gem::Version
|
90
|
-
version: '
|
92
|
+
version: '3.1'
|
91
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
94
|
requirements:
|
93
95
|
- - ">="
|
94
96
|
- !ruby/object:Gem::Version
|
95
97
|
version: '0'
|
96
98
|
requirements: []
|
97
|
-
rubygems_version: 3.
|
99
|
+
rubygems_version: 3.5.11
|
98
100
|
signing_key:
|
99
101
|
specification_version: 4
|
100
102
|
summary: A transport agnostic RESP protocol client/server.
|
metadata.gz.sig
CHANGED
Binary file
|