rails_kvs_driver 0.1.1 → 0.1.2

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
  SHA1:
3
- metadata.gz: c7ddf0941104add01d27ce485c21bc06fa16728a
4
- data.tar.gz: 0bc51b918fe540b0fe82ccb5e3b3c69786b89096
3
+ metadata.gz: 4f78813ebc99ba319770bd8ef0c4fbdc09514cd4
4
+ data.tar.gz: b59f2e73ab356e50cb73f455582c9765d3951684
5
5
  SHA512:
6
- metadata.gz: b3445f723dab3e14caa5a81a9dd01af44615caee7dc39275cf3a089535dfbc1043ba35442dc8f42b2a7c2579b2a783a82be9e6fcc6f88dced224a8f279332897
7
- data.tar.gz: e8a8d6f609bb3a86061b7c2aa0ba49d5799de7e46e6ffc54c04464b4876810e6c27a7eeaa4484e0da528d6761cea481357305e34e95411c7fa743dac14024db1
6
+ metadata.gz: be8643028faa6de55130899e3e45c267db0eab94a3af8e2be727cc531a204856aca4b4ad9adc824d0e568a4f9e08fd274078ece81529ed76170f32bb2669067c
7
+ data.tar.gz: 260084bd150f5ebb1452e6be392543694c7832a62fa3f8ae7c0cc2c63b0e981c8fd17242d8ab8a2b58ec23af85f1d25e1b27b5c53924aed5776bb0cb66d99f66
@@ -34,7 +34,16 @@ module RailsKvsDriver
34
34
  return member_set
35
35
  end
36
36
 
37
+ # count member of sorted_set
38
+ #
39
+ # @param key [String] sorted_set key
40
+ def count(key)
41
+ @driver_instance.count_sorted_set_member(key)
42
+ end
43
+
37
44
  # delete key
45
+ #
46
+ # @param key [String] sorted_set key
38
47
  def delete(key)
39
48
  @driver_instance.delete(key)
40
49
  end
@@ -52,7 +61,7 @@ module RailsKvsDriver
52
61
  # @param limit [Integer] limit number to acquire at a time.
53
62
  # @param &block [{|member, score, position| }] each the block of code for each member of sorted set.
54
63
  def each_member(key, reverse=false, limit=1000)
55
- member_count = @driver_instance.count_sorted_set_member(key)
64
+ member_count = count(key)
56
65
  member_position = 0
57
66
 
58
67
  while member_position < member_count
@@ -92,5 +101,13 @@ module RailsKvsDriver
92
101
  def length
93
102
  keys.length
94
103
  end
104
+
105
+ # remove member of sorted_set
106
+ #
107
+ # @param key [String] sorted_set key
108
+ # @param member [String] member of sorted_se
109
+ def remove(key, member)
110
+ @driver_instance.remove_sorted_set(key, member)
111
+ end
95
112
  end
96
113
  end
@@ -1,3 +1,3 @@
1
1
  module RailsKvsDriver
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -12,7 +12,8 @@ describe RailsKvsDriver::SortedSet do
12
12
  get_sorted_set: [[:a,:b],[:c,:d]],
13
13
  get_sorted_set_keys: [:a,:b,:c],
14
14
  get_sorted_set_score: 100,
15
- increment_sorted_set: 10
15
+ increment_sorted_set: 10,
16
+ remove_sorted_set: true
16
17
  })
17
18
  end
18
19
 
@@ -25,6 +26,10 @@ describe RailsKvsDriver::SortedSet do
25
26
  expect(@driver.sorted_sets['hoge','fuga']).to eq(100)
26
27
  end
27
28
 
29
+ it 'call count' do
30
+ expect(@driver.sorted_sets.count(:a)).to eq(100)
31
+ end
32
+
28
33
  it 'call delete' do
29
34
  expect(@driver.sorted_sets.delete(:a)).to be_true
30
35
  end
@@ -63,4 +68,8 @@ describe RailsKvsDriver::SortedSet do
63
68
  it 'call length' do
64
69
  expect(@driver.sorted_sets.length).to eq(3)
65
70
  end
71
+
72
+ it 'call remove' do
73
+ expect(@driver.sorted_sets.remove(:a, :b)).to be_true
74
+ end
66
75
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_kvs_driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - alfa-jpn