valkey-objects 0.4.8 → 0.4.9
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/CHANGELOG.md +1 -1
- data/CODE_OF_CONDUCT.md +1 -1
- data/Gemfile +8 -0
- data/Gemfile.lock +25 -0
- data/LICENSE.txt +1 -1
- data/README.md +41 -88
- data/lib/valkey/objects/version.rb +1 -1
- data/lib/valkey/objects.rb +482 -723
- data/lib/valkey/objects.rb~ +10 -0
- metadata +15 -153
- data/valkey-objects.gemspec +0 -49
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6c5fb0e66b8b172e6655d867242d9de418ce3cb29c84ef6a5a9c8f7fcbe3f477
|
|
4
|
+
data.tar.gz: 3e48f537dc52b0755dd7f5555c398761cc66285c7bed8899e113ad52441eeead
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 077f802238c816d22917e8d546f3173c51411ac1ed94ad0e70ddfc19924c15c73e182aa7cde5ef24a1c6950a38e028da67c794fcd7495a034a7d0657c75afa3e
|
|
7
|
+
data.tar.gz: eb6cd6e81ba8e5c2a29378943c2cc5de9225efb73dc9bee8da01b617c4691bf3083a305ca9ed4b41d093317b20483884071b0c9fc32d2973b2ac931138225140
|
data/CHANGELOG.md
CHANGED
data/CODE_OF_CONDUCT.md
CHANGED
|
@@ -39,7 +39,7 @@ This Code of Conduct applies within all community spaces, and also applies when
|
|
|
39
39
|
|
|
40
40
|
## Enforcement
|
|
41
41
|
|
|
42
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at
|
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at xorgnak@xorgnak.com. All complaints will be reviewed and investigated promptly and fairly.
|
|
43
43
|
|
|
44
44
|
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
|
45
45
|
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
valkey-objects (0.4.9)
|
|
5
|
+
redis
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
connection_pool (2.5.4)
|
|
11
|
+
rake (13.0.6)
|
|
12
|
+
redis (5.4.1)
|
|
13
|
+
redis-client (>= 0.22.0)
|
|
14
|
+
redis-client (0.25.1)
|
|
15
|
+
connection_pool
|
|
16
|
+
|
|
17
|
+
PLATFORMS
|
|
18
|
+
x86_64-linux
|
|
19
|
+
|
|
20
|
+
DEPENDENCIES
|
|
21
|
+
rake (~> 13.0)
|
|
22
|
+
valkey-objects!
|
|
23
|
+
|
|
24
|
+
BUNDLED WITH
|
|
25
|
+
2.3.15
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -1,97 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
Based upon the redis-objects library, VK allows for ValKey backed ruby objects.
|
|
1
|
+
## Installation
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
```
|
|
6
|
-
gem install valkey-objects
|
|
7
|
-
```
|
|
3
|
+
Install the gem and add to the application's Gemfile by executing:
|
|
8
4
|
|
|
9
|
-
|
|
5
|
+
$ bundle add valkey-objects
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
```
|
|
13
|
-
require 'valkey/objects'
|
|
14
|
-
class ValKey
|
|
15
|
-
# 1. include valkey-objects layer
|
|
16
|
-
include VK
|
|
17
|
-
# 2. stitch your object together.
|
|
18
|
-
value :myvalue
|
|
19
|
-
counter :mycounter
|
|
20
|
-
hashkey :myhash
|
|
21
|
-
sortedset :mysortedset
|
|
22
|
-
set :myset
|
|
23
|
-
queue :myqueue
|
|
24
|
-
place :myplace
|
|
25
|
-
pipe :mypipe
|
|
26
|
-
toggle :mytoggle
|
|
27
|
-
# 3. define @id in initialize.
|
|
28
|
-
def initialize k
|
|
29
|
-
@id = k
|
|
30
|
-
end
|
|
31
|
-
# other stuff...
|
|
32
|
-
end
|
|
7
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
33
8
|
|
|
34
|
-
|
|
35
|
-
@x.mypipe.on { |msg| puts %[MSG]; ap msg }
|
|
36
|
-
@x.mypipe << "Pipe Connected!"
|
|
37
|
-
@x.myvalue.value = "Hello, World"
|
|
38
|
-
@x.mycounter.value = 1.2345
|
|
39
|
-
@x.myhash[:key] = "Value"
|
|
40
|
-
@x.mysortedset["my other key"] = 9.8
|
|
41
|
-
@x.mysortedset.poke "my key", @x.mysortedset["my other key"]
|
|
42
|
-
@x.mysortedset.value { |i, e| puts %[Sorted Sets: i: #{i} e: #{e}] }
|
|
43
|
-
@x.myset << "my member"
|
|
44
|
-
@x.myset << "my new member"
|
|
45
|
-
h = @x.myset[/ new /]
|
|
46
|
-
@x.myset.value { |i, e| puts %[Sets: i: #{i} e: #{e}] }
|
|
47
|
-
@x.myplace.add "Palermo", 13.361389, 38.115556
|
|
48
|
-
@x.myplace.add "Catania", 15.087269, 37.502669
|
|
49
|
-
distance = @x.myplace.distance "Palermo", "Catania"
|
|
50
|
-
places = @x.myplace.radius 15.087269, 37.502669, 5000
|
|
51
|
-
@x.myplace.value { |i, e| puts %[Places: i: #{i} e: #{e}] }
|
|
52
|
-
```
|
|
9
|
+
$ gem install valkey-objects
|
|
53
10
|
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
class Game
|
|
57
|
-
include VK
|
|
58
|
-
sortedset :points
|
|
59
|
-
def initialize k
|
|
60
|
-
@id = k
|
|
61
|
-
end
|
|
62
|
-
def score p, h={ points: 1 }
|
|
63
|
-
self.points.poke p, h[:points]
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
@game = Hash.new { |h,k| h[k] = Game.new(k) }
|
|
68
|
-
```
|
|
11
|
+
## Usage
|
|
69
12
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
@id = k
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
def self.keys
|
|
83
|
-
@@X.keys
|
|
84
|
-
end
|
|
85
|
-
def self.[] k
|
|
86
|
-
if !@@X.has_key?(k)
|
|
87
|
-
@@X[k].ear.on { |msg| puts "MSG[#{k}]:"; ap msg }
|
|
88
|
-
end
|
|
89
|
-
@@X[k]
|
|
90
|
-
end
|
|
13
|
+
```ruby
|
|
14
|
+
class X
|
|
15
|
+
include ValkeyObjects
|
|
16
|
+
value :myValue
|
|
17
|
+
counter :myCounter
|
|
18
|
+
list :myList
|
|
19
|
+
set :mySet
|
|
20
|
+
hash_key :myHash
|
|
21
|
+
sorted_set :mySortedSet
|
|
91
22
|
end
|
|
92
23
|
|
|
93
|
-
X
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
24
|
+
@user = X.new
|
|
25
|
+
@user.myValue.value = "Alice"
|
|
26
|
+
@user.myValue.value #=> "Alice"
|
|
27
|
+
|
|
28
|
+
@user.myCounter.increment
|
|
29
|
+
@user.myCounter.decrement
|
|
30
|
+
@user.myCounter.increment 1
|
|
31
|
+
@user.myCounter.decrement 2
|
|
32
|
+
@user.myCounter.to_i #=> -1
|
|
33
|
+
|
|
34
|
+
@user.myList << "item"
|
|
35
|
+
@user.myList << "this"
|
|
36
|
+
@user.myList[1] #=> "this"
|
|
37
|
+
@user.myList[1] = "next"
|
|
38
|
+
@user.myList.shift
|
|
39
|
+
@user.myList.to_a #=> ["next"]
|
|
40
|
+
@user.myList.knn #=> values as KNN object
|
|
41
|
+
|
|
42
|
+
@user.mySet << "one"
|
|
43
|
+
@user.mySet << "two"
|
|
44
|
+
@user.mySet.members
|
|
45
|
+
@user.mySet.knn #=> members as KNN object
|
|
46
|
+
|
|
47
|
+
@user.myHash[:key] = "value"
|
|
48
|
+
@user.myHash[:key] #=> "value"
|
|
49
|
+
@user.myHash.to_h
|
|
97
50
|
```
|