valkey-objects 0.2.7 → 0.2.9

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: 25a876de8020a0d8f8c5830d9d632c23b488ae935a27e286af7b186ef181f4ef
4
- data.tar.gz: 7ee8daf5fe4ec9f04319eca9056ab384684faf004160b0a66c397ae006e322c6
3
+ metadata.gz: e91f9301c09a4ad135df31fe626a96d08280fc644b101376fa46b2e8681ffff1
4
+ data.tar.gz: fda897186e70bcc597a7ea99991fc683d245423bea3095bacb97978b27ddbb91
5
5
  SHA512:
6
- metadata.gz: 592b2de00bde7253cab8b05b9336babe2d097ef5397f152d93d5dc240d3830726e444bf0e798519dbe6849f9723a5b6ad17f0215ec782167061523922c1f7a11
7
- data.tar.gz: 16063b655a6074001129db77e12a00fc18eccc6a74b1af01a60a1644eb9eccf36a4adea2be97a12defaa4c4882c131f75cc0cda78c23c10dece597e0ee719cef
6
+ metadata.gz: 050f363cfe1a8154a8fdac9ddd1ace13877643f873edf4b2ca6b89846e150b3774697f533d358bf124d829f4353176e5810fca60e6ab82ef05b9ce7fe711a72a
7
+ data.tar.gz: 3b3cb373c7a6db40795cc692c1f29ce582ae9eb37462914951896ebca8d50ac346b4170d9992787e0b2343ba9e7139e89aff0992dabd00d3080de46108fd8588
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Valkey
4
4
  module Objects
5
- VERSION = "0.2.7"
5
+ VERSION = "0.2.9"
6
6
  end
7
7
  end
@@ -8,6 +8,8 @@ require 'json'
8
8
  require 'ruby-duration'
9
9
  require 'amatch'
10
10
  require 'ap'
11
+ require 'yaml'
12
+
11
13
  module VK
12
14
 
13
15
  @@XX = {}
@@ -233,7 +235,8 @@ module VK
233
235
  attr_reader :key
234
236
  def initialize k, h={}
235
237
  @key = k
236
- @opts = h
238
+ @opts = h
239
+ # puts %[VK #{@key} #{h}]
237
240
  if @opts.has_key?(:ttl)
238
241
  expire @opts[:ttl]
239
242
  end
@@ -244,16 +247,16 @@ module VK
244
247
  def expire sec
245
248
  VK.redis.call("EXPIRE", key, sec);
246
249
  end
247
- end
248
-
249
- class TIMESTAMP < O
250
250
  def value
251
251
  x = VK.redis.call("GET", key);
252
252
  if @opts.has_key?(:flush) == true
253
253
  delete!
254
254
  end
255
255
  return x
256
- end
256
+ end
257
+ end
258
+
259
+ class TIMESTAMP < O
257
260
  def value!
258
261
  VK.redis.call("SET", key, "#{VK.clock.to_i}");
259
262
  end
@@ -270,10 +273,11 @@ module VK
270
273
 
271
274
  class TOGGLE < O
272
275
  def value
273
- VK.redis.call("GET", key) == 'true' ? true : false
276
+ x = VK.redis.call("GET", key) == 'true' ? true : false
274
277
  if @opts.has_key?(:flush) == true
275
278
  delete!
276
279
  end
280
+ return x
277
281
  end
278
282
  def exist?
279
283
  VK.redis.call("GET", key) ? true : false
@@ -282,7 +286,7 @@ module VK
282
286
  VK.redis.call("SET", key, "#{x.to_s}")
283
287
  end
284
288
  def value!
285
- if self.value
289
+ if self.value == true || self.value == nil
286
290
  self.value = false
287
291
  else
288
292
  self.value = true
@@ -292,10 +296,11 @@ module VK
292
296
 
293
297
  class VALUE < O
294
298
  def value
295
- VK.redis.call("GET", key)
299
+ x = VK.redis.call("GET", key)
296
300
  if @opts.has_key?(:flush) == true
297
301
  delete!
298
302
  end
303
+ return x.to_f
299
304
  end
300
305
  def value= x
301
306
  VK.redis.call("SET", key, x)
@@ -361,22 +366,23 @@ module VK
361
366
 
362
367
  class COUNTER < O
363
368
  def incr n
364
- VK.redis.call("SET", key, value + n.to_f)
369
+ VK.redis.call("SET", @key, value + n.to_f)
365
370
  end
366
371
  def decr n
367
- VK.redis.call("SET", key, value + n.to_f)
372
+ VK.redis.call("SET", @key, value + n.to_f)
368
373
  end
369
374
  def value
370
- VK.redis.call("GET", key).to_f
375
+ x = VK.redis.call("GET", @key).to_f
371
376
  if @opts.has_key?(:flush) == true
372
377
  delete!
373
- end
378
+ end
379
+ return x
374
380
  end
375
381
  def value= n
376
- VK.redis.call("SET", key, n.to_f)
382
+ VK.redis.call("SET", @key, n.to_f)
377
383
  end
378
384
  def exist?
379
- VK.redis.call("GET", key) ? true : false
385
+ VK.redis.call("GET", @key) ? true : false
380
386
  end
381
387
  end
382
388
 
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.2.7
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Olson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-01-20 00:00:00.000000000 Z
11
+ date: 2025-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis-client