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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c0a9c6aca1b5339587ab8d14cba5dee0fa05f0ffdb3460fd349282d384c76038
4
- data.tar.gz: 4d542d22a756ae8ce4dff600aae73f6f9a4cc41deb0db7abe91b6395a042fb02
3
+ metadata.gz: f7c6c5ce3863e4e9bb256dd1218cd56f62c4b08a48c7c1f5a686aabcfc7d7308
4
+ data.tar.gz: 147d64b217213c6eb1ff04a29a0e7dc51a8a46e45c2b0b087042d2df5d4aaa19
5
5
  SHA512:
6
- metadata.gz: 50cff3351928a9b7f66f871f9fdab25f65646e7b4978eb981f1e9671babe40472e95a1d8e5c8121aa285cc64fb6148ee8488af852b8de9b87ed17338274e1bbc
7
- data.tar.gz: e823ed4e7c79546888de0e527384fb02860c992b8ac5ad8c09072ba9ba9d461c312cb64dfc7867a60dda0aca55ca0aee889a6fc0e1c5db2db222da5da403be9a
6
+ metadata.gz: 24a0bbca6bc325880dc8041b7ba5f76d4ce66863d39c5ba775a9199aab2a569df88e29df4b742f681831667b5a92170418eb796fbdecd8d688573e186d0f58fc
7
+ data.tar.gz: 3284592d59354a5ccbf066cde5f715d9eef79c5d3e022ce93589e02c57cf23b0c88b09d4b93ecb4887900ea05f3e5dd8951f40d509b3e915834824c61f8ded57
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Valkey
4
4
  module Objects
5
- VERSION = "0.1.2"
5
+ VERSION = "0.1.4"
6
6
  end
7
7
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: valkey-objects
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Olson