valkey-objects 0.1.8 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/valkey/objects/version.rb +1 -1
- data/lib/valkey/objects.rb +3 -2
- data/valkey-objects.gemspec +2 -0
- metadata +30 -8
- data/#class.rb# +0 -21
- data/class.rb~ +0 -97
- data/example.rb~ +0 -101
- data/module.rb~ +0 -57
- data/valkey-objects-0.1.0.gem +0 -0
- data/valkey-objects-0.1.1.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66451b3bbdc217925b068c50c8cdcd5cd392a6ddef99adbc7300c683c112d152
|
4
|
+
data.tar.gz: eb06049f2987c87b8cb7fb188e15960fab83d2f7a820205b3ddd06df1ed11828
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78d4470e2aa1cc2b9763265c7a940f4f2da58798460fbce998e2aedd32cdcd6136accca257d83719328e59011b6da185c59f590863642d430488966b9a77cb9e
|
7
|
+
data.tar.gz: ad6b0974b14ebd9bc022aa259a4a953556d5ec567d370a0335b279fc695f655713cba4d0499e8cb7d6bc15e610a5ba4918d8a81bdeca4ce8820bd0d65f8f6439
|
data/lib/valkey/objects.rb
CHANGED
@@ -5,7 +5,7 @@ require_relative "objects/version"
|
|
5
5
|
require 'redis-client'
|
6
6
|
require 'json'
|
7
7
|
require 'ruby-duration'
|
8
|
-
|
8
|
+
require 'ap'
|
9
9
|
module VK
|
10
10
|
def self.included(x)
|
11
11
|
x.extend VK
|
@@ -362,11 +362,12 @@ module VK
|
|
362
362
|
return h
|
363
363
|
end
|
364
364
|
end
|
365
|
+
|
365
366
|
def self.flushdb!
|
366
367
|
VK.redis.call("FLUSHDB")
|
367
368
|
end
|
369
|
+
|
368
370
|
def self.[] k
|
369
371
|
VK.redis.call("KEYS", k)
|
370
372
|
end
|
371
373
|
end
|
372
|
-
|
data/valkey-objects.gemspec
CHANGED
@@ -34,6 +34,8 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_dependency "redis-client"
|
35
35
|
spec.add_dependency "json"
|
36
36
|
spec.add_dependency "ruby-duration"
|
37
|
+
spec.add_dependency "pry"
|
38
|
+
spec.add_dependency "awesome_print"
|
37
39
|
# For more information and examples about making a new gem, check out our
|
38
40
|
# guide at: https://bundler.io/guides/creating_gem.html
|
39
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: valkey-objects
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Olson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis-client
|
@@ -52,6 +52,34 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: awesome_print
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
55
83
|
description: A ruby valkey client inspired by the redis-objects gem.
|
56
84
|
email:
|
57
85
|
- xorgnak@gmail.com
|
@@ -59,20 +87,14 @@ executables: []
|
|
59
87
|
extensions: []
|
60
88
|
extra_rdoc_files: []
|
61
89
|
files:
|
62
|
-
- "#class.rb#"
|
63
90
|
- CHANGELOG.md
|
64
91
|
- CODE_OF_CONDUCT.md
|
65
92
|
- LICENSE.txt
|
66
93
|
- README.md
|
67
94
|
- Rakefile
|
68
|
-
- class.rb~
|
69
|
-
- example.rb~
|
70
95
|
- lib/valkey/objects.rb
|
71
96
|
- lib/valkey/objects/version.rb
|
72
|
-
- module.rb~
|
73
97
|
- sig/valkey/objects.rbs
|
74
|
-
- valkey-objects-0.1.0.gem
|
75
|
-
- valkey-objects-0.1.1.gem
|
76
98
|
- valkey-objects.gemspec
|
77
99
|
homepage: https://github.com/xorgnak/valkey-client
|
78
100
|
licenses:
|
data/#class.rb#
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'valkey/objects'
|
4
|
-
|
5
|
-
require 'pry'
|
6
|
-
|
7
|
-
class Game
|
8
|
-
include VK
|
9
|
-
sortedset :points
|
10
|
-
queue :log
|
11
|
-
def initialize k
|
12
|
-
@id = k
|
13
|
-
end
|
14
|
-
def score p, h={ points: 1 }
|
15
|
-
self.points.poke p, h[:points]
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
@game = Hash.new { |h,k| h[k] = Game.new(k) }
|
20
|
-
|
21
|
-
Pry.start
|
data/class.rb~
DELETED
@@ -1,97 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'valkey/objects'
|
4
|
-
|
5
|
-
# Using ValKey Objects
|
6
|
-
## Create your class object
|
7
|
-
class ValKey
|
8
|
-
# 1. include valkey-objects layer
|
9
|
-
include VK
|
10
|
-
# 2. stitch your object together.
|
11
|
-
value :myvalue
|
12
|
-
counter :mycounter
|
13
|
-
hashkey :myhash
|
14
|
-
sortedset :mysortedset
|
15
|
-
set :myset
|
16
|
-
queue :myqueue
|
17
|
-
place :myplace
|
18
|
-
pipe :mypipe
|
19
|
-
toggle :mytoggle
|
20
|
-
# 3. define @id in initialize.
|
21
|
-
def initialize k
|
22
|
-
@id = k
|
23
|
-
end
|
24
|
-
# other stuff...
|
25
|
-
end
|
26
|
-
|
27
|
-
## then user it.
|
28
|
-
puts %[=== Valkey Object Test ===]
|
29
|
-
@x = ValKey.new("My Special Valkey object.")
|
30
|
-
#### pub/sub pipe
|
31
|
-
##### on message
|
32
|
-
@x.mypipe.on { |msg| puts %[MSG]; ap msg }
|
33
|
-
##### publish message
|
34
|
-
@x.mypipe << "Pipe Connected!"
|
35
|
-
### get/set string value...
|
36
|
-
@x.myvalue.value = "Hello, World"
|
37
|
-
### get/set/incr/decr float value...
|
38
|
-
@x.mycounter.value = 1.2345
|
39
|
-
### get/set key/value pairs...
|
40
|
-
@x.myhash[:key] = "Value"
|
41
|
-
### sort keys by score...
|
42
|
-
#### set
|
43
|
-
@x.mysortedset["my other key"] = 9.8
|
44
|
-
#### poke/get
|
45
|
-
@x.mysortedset.poke "my key", @x.mysortedset["my other key"]
|
46
|
-
#### by high score
|
47
|
-
@x.mysortedset.value { |i, e| ap %[Sorted Sets: i: #{i} e: #{e}] }
|
48
|
-
### collect keys...
|
49
|
-
@x.myset << "my member"
|
50
|
-
@x.myset << "my new member"
|
51
|
-
#### filter by regexp...
|
52
|
-
h = @x.myset[/ new /]
|
53
|
-
puts %[Filtered set members:]
|
54
|
-
ap h
|
55
|
-
#### each collection key....
|
56
|
-
@x.myset.value { |i, e| puts %[Sets: i: #{i} e: #{e}] }
|
57
|
-
### points by coordinates...
|
58
|
-
@x.myplace.add "Palermo", 13.361389, 38.115556
|
59
|
-
@x.myplace.add "Catania", 15.087269, 37.502669
|
60
|
-
#### distance between points.
|
61
|
-
distance = @x.myplace.distance "Palermo", "Catania"
|
62
|
-
ap %[The meters between the points: #{distance}]
|
63
|
-
#### places within radius by coordinates
|
64
|
-
places = @x.myplace.radius 15.087269, 37.502669, 5000
|
65
|
-
ap %[The places within 5000 meters of the coordinates: #{places}]
|
66
|
-
puts %[Place Values...]
|
67
|
-
#### collection of places...
|
68
|
-
@x.myplace.value { |i, e| puts %[Places: i: #{i} e: #{e}] }
|
69
|
-
ap VK['*']
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
## Or as a collection of "X"s...
|
74
|
-
module X
|
75
|
-
@@X = Hash.new { |h,k| h[k] = Ex.new(k) }
|
76
|
-
class Ex
|
77
|
-
include VK
|
78
|
-
set :stuff
|
79
|
-
pipe :ear
|
80
|
-
def initialize k
|
81
|
-
@id = k
|
82
|
-
end
|
83
|
-
end
|
84
|
-
def self.keys
|
85
|
-
@@X.keys
|
86
|
-
end
|
87
|
-
def self.[] k
|
88
|
-
if !@@X.has_key?(k)
|
89
|
-
@@X[k].ear.on { |msg| puts "MSG[#{k}]:"; ap msg }
|
90
|
-
end
|
91
|
-
@@X[k]
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
@x[:a] = X['Aaa']
|
96
|
-
@x[:b] = X['Bbb']
|
97
|
-
@x[:c] = X['Ccc']
|
data/example.rb~
DELETED
@@ -1,101 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'valkey/objects'
|
4
|
-
|
5
|
-
# Using ValKey Objects
|
6
|
-
## Create your class object
|
7
|
-
class ValKey
|
8
|
-
# 1. include valkey-objects layer
|
9
|
-
include VK
|
10
|
-
# 2. stitch your object together.
|
11
|
-
value :myvalue
|
12
|
-
counter :mycounter
|
13
|
-
hashkey :myhash
|
14
|
-
sortedset :mysortedset
|
15
|
-
set :myset
|
16
|
-
queue :myqueue
|
17
|
-
place :myplace
|
18
|
-
pipe :mypipe
|
19
|
-
toggle :mytoggle
|
20
|
-
# 3. define @id in initialize.
|
21
|
-
def initialize k
|
22
|
-
@id = k
|
23
|
-
end
|
24
|
-
# other stuff...
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
require 'awesome_print'
|
30
|
-
|
31
|
-
@x = {}
|
32
|
-
|
33
|
-
## then user it.
|
34
|
-
puts %[=== Valkey Object Test ===]
|
35
|
-
@x[:x] = ValKey.new("My Special Valkey object.")
|
36
|
-
#### pub/sub pipe
|
37
|
-
##### on message
|
38
|
-
@x[:x].mypipe.on { |msg| puts %[MSG]; ap msg }
|
39
|
-
##### publish message
|
40
|
-
@x[:x].mypipe << "Pipe Connected!"
|
41
|
-
### get/set string value...
|
42
|
-
@x[:x].myvalue.value = "Hello, World"
|
43
|
-
### get/set/incr/decr float value...
|
44
|
-
@x[:x].mycounter.value = 1.2345
|
45
|
-
### get/set key/value pairs...
|
46
|
-
@x[:x].myhash[:key] = "Value"
|
47
|
-
### sort keys by score...
|
48
|
-
#### set
|
49
|
-
@x[:x].mysortedset["my other key"] = 9.8
|
50
|
-
#### poke/get
|
51
|
-
@x[:x].mysortedset.poke "my key", @x[:x].mysortedset["my other key"]
|
52
|
-
#### by high score
|
53
|
-
@x[:x].mysortedset.value { |i, e| ap %[Sorted Sets: i: #{i} e: #{e}] }
|
54
|
-
### collect keys...
|
55
|
-
@x[:x].myset << "my member"
|
56
|
-
@x[:x].myset << "my new member"
|
57
|
-
#### filter by regexp...
|
58
|
-
h = @x[:x].myset[/ new /]
|
59
|
-
puts %[Filtered set members:]
|
60
|
-
ap h
|
61
|
-
#### each collection key....
|
62
|
-
@x[:x].myset.value { |i, e| puts %[Sets: i: #{i} e: #{e}] }
|
63
|
-
### points by coordinates...
|
64
|
-
@x[:x].myplace.add "Palermo", 13.361389, 38.115556
|
65
|
-
@x[:x].myplace.add "Catania", 15.087269, 37.502669
|
66
|
-
#### distance between points.
|
67
|
-
distance = @x[:x].myplace.distance "Palermo", "Catania"
|
68
|
-
ap %[The meters between the points: #{distance}]
|
69
|
-
#### places within radius by coordinates
|
70
|
-
places = @x[:x].myplace.radius 15.087269, 37.502669, 5000
|
71
|
-
ap %[The places within 5000 meters of the coordinates: #{places}]
|
72
|
-
puts %[Place Values...]
|
73
|
-
#### collection of places...
|
74
|
-
@x[:x].myplace.value { |i, e| puts %[Places: i: #{i} e: #{e}] }
|
75
|
-
ap VK['*']
|
76
|
-
|
77
|
-
## Or as a collection of "X"s...
|
78
|
-
module X
|
79
|
-
@@X = Hash.new { |h,k| h[k] = Ex.new(k) }
|
80
|
-
class Ex
|
81
|
-
include VK
|
82
|
-
set :stuff
|
83
|
-
pipe :ear
|
84
|
-
def initialize k
|
85
|
-
@id = k
|
86
|
-
end
|
87
|
-
end
|
88
|
-
def self.keys
|
89
|
-
@@X.keys
|
90
|
-
end
|
91
|
-
def self.[] k
|
92
|
-
if !@@X.has_key?(k)
|
93
|
-
@@X[k].ear.on { |msg| puts "MSG[#{k}]:"; ap msg }
|
94
|
-
end
|
95
|
-
@@X[k]
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
@x[:a] = X['Aaa']
|
100
|
-
@x[:b] = X['Bbb']
|
101
|
-
@x[:c] = X['Ccc']
|
data/module.rb~
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'valkey/objects'
|
4
|
-
|
5
|
-
# Using ValKey Objects
|
6
|
-
## Create your class object
|
7
|
-
class ValKey
|
8
|
-
# 1. include valkey-objects layer
|
9
|
-
include VK
|
10
|
-
# 2. stitch your object together.
|
11
|
-
value :myvalue
|
12
|
-
counter :mycounter
|
13
|
-
hashkey :myhash
|
14
|
-
sortedset :mysortedset
|
15
|
-
set :myset
|
16
|
-
queue :myqueue
|
17
|
-
place :myplace
|
18
|
-
pipe :mypipe
|
19
|
-
toggle :mytoggle
|
20
|
-
# 3. define @id in initialize.
|
21
|
-
def initialize k
|
22
|
-
@id = k
|
23
|
-
end
|
24
|
-
# other stuff...
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
require 'awesome_print'
|
30
|
-
|
31
|
-
@x = {}
|
32
|
-
|
33
|
-
## Or as a collection of "X"s...
|
34
|
-
module X
|
35
|
-
@@X = Hash.new { |h,k| h[k] = Ex.new(k) }
|
36
|
-
class Ex
|
37
|
-
include VK
|
38
|
-
set :stuff
|
39
|
-
pipe :ear
|
40
|
-
def initialize k
|
41
|
-
@id = k
|
42
|
-
end
|
43
|
-
end
|
44
|
-
def self.keys
|
45
|
-
@@X.keys
|
46
|
-
end
|
47
|
-
def self.[] k
|
48
|
-
if !@@X.has_key?(k)
|
49
|
-
@@X[k].ear.on { |msg| puts "MSG[#{k}]:"; ap msg }
|
50
|
-
end
|
51
|
-
@@X[k]
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
X['Aaa'].ear << %[A]
|
56
|
-
X['Bbb'].ear << %[B]
|
57
|
-
X['Ccc'].ear << %[C]
|
data/valkey-objects-0.1.0.gem
DELETED
Binary file
|
data/valkey-objects-0.1.1.gem
DELETED
Binary file
|