valkey-objects 0.1.2 → 0.1.4
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 +16 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7c6c5ce3863e4e9bb256dd1218cd56f62c4b08a48c7c1f5a686aabcfc7d7308
|
4
|
+
data.tar.gz: 147d64b217213c6eb1ff04a29a0e7dc51a8a46e45c2b0b087042d2df5d4aaa19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24a0bbca6bc325880dc8041b7ba5f76d4ce66863d39c5ba775a9199aab2a569df88e29df4b742f681831667b5a92170418eb796fbdecd8d688573e186d0f58fc
|
7
|
+
data.tar.gz: 3284592d59354a5ccbf066cde5f715d9eef79c5d3e022ce93589e02c57cf23b0c88b09d4b93ecb4887900ea05f3e5dd8951f40d509b3e915834824c61f8ded57
|
data/lib/valkey/objects.rb
CHANGED
@@ -145,6 +145,10 @@ module VK
|
|
145
145
|
Clock.new(k)
|
146
146
|
end
|
147
147
|
end
|
148
|
+
|
149
|
+
def self.at epoch
|
150
|
+
Time.at epoch
|
151
|
+
end
|
148
152
|
|
149
153
|
def self.clock *t
|
150
154
|
if t[0]
|
@@ -163,6 +167,12 @@ module VK
|
|
163
167
|
def initialize k
|
164
168
|
@key = k
|
165
169
|
end
|
170
|
+
def delete!
|
171
|
+
VK.redis.call("DEL", key);
|
172
|
+
end
|
173
|
+
def expire sec
|
174
|
+
VK.redis.call("EXPIRE", key, sec);
|
175
|
+
end
|
166
176
|
end
|
167
177
|
|
168
178
|
class N < O
|
@@ -172,6 +182,12 @@ module VK
|
|
172
182
|
def value!
|
173
183
|
VK.redis.call("SET", key, "#{VK.clock.to_i}");
|
174
184
|
end
|
185
|
+
def ago
|
186
|
+
VK.clock.to_i - value;
|
187
|
+
end
|
188
|
+
def to_time
|
189
|
+
Time.at(value);
|
190
|
+
end
|
175
191
|
end
|
176
192
|
|
177
193
|
class T < O
|