splitclient-rb 8.4.0 → 8.4.1.pre.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/splitclient-rb/cache/filter/bloom_filter.rb +10 -6
- data/lib/splitclient-rb/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f5c4eeedc44963558586b999cd4f33c39ca80f5bfc4c80041a740b588e94595
|
4
|
+
data.tar.gz: 34373355b4b0657fa86a44522ae33d23a8a0fb3b2db43dd78d0b2cfaee33b1d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e6bc70886bd26787fa73a3d98e7840d7338d2431595de4f588b59a2861b91de165ba97e2eb6ad21685920aa0a18095f1bdd00ffc5b5d7c4d55c3d79ba8c52cc
|
7
|
+
data.tar.gz: 84461ff3ae4dfc419249387ae86503e28ec00971d93d24dd138d7669c299b368488ce8ec9d09b9e1f0e8228da377ae9965900398bc745ca1a8b2d461bc416c3e
|
@@ -8,8 +8,8 @@ module SplitIoClient
|
|
8
8
|
class BloomFilter
|
9
9
|
def initialize(capacity, false_positive_probability = 0.001)
|
10
10
|
@capacity = capacity.round
|
11
|
-
m = best_m(capacity, false_positive_probability)
|
12
|
-
|
11
|
+
@m = best_m(capacity, false_positive_probability)
|
12
|
+
reset_filter
|
13
13
|
@k = best_k(capacity)
|
14
14
|
end
|
15
15
|
|
@@ -17,22 +17,26 @@ module SplitIoClient
|
|
17
17
|
return false if contains?(string)
|
18
18
|
|
19
19
|
positions = hashes(string)
|
20
|
-
|
21
20
|
positions.each { |position| @ba[position] = 1 }
|
22
21
|
|
23
22
|
true
|
24
23
|
end
|
25
|
-
|
24
|
+
|
26
25
|
def contains?(string)
|
27
26
|
!hashes(string).any? { |ea| @ba[ea] == 0 }
|
28
27
|
end
|
29
28
|
|
30
29
|
def clear
|
31
|
-
@ba
|
30
|
+
@ba = nil
|
31
|
+
reset_filter
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
private
|
35
35
|
|
36
|
+
def reset_filter
|
37
|
+
@ba = BitArray.new(@m.round)
|
38
|
+
end
|
39
|
+
|
36
40
|
# m is the required number of bits in the array
|
37
41
|
def best_m(capacity, false_positive_probability)
|
38
42
|
-(capacity * Math.log(false_positive_probability)) / (Math.log(2) ** 2)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: splitclient-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.4.
|
4
|
+
version: 8.4.1.pre.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Split Software
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: allocation_stats
|
@@ -590,11 +590,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
590
590
|
version: 2.5.0
|
591
591
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
592
592
|
requirements:
|
593
|
-
- - "
|
593
|
+
- - ">"
|
594
594
|
- !ruby/object:Gem::Version
|
595
|
-
version:
|
595
|
+
version: 1.3.1
|
596
596
|
requirements: []
|
597
|
-
rubygems_version: 3.
|
597
|
+
rubygems_version: 3.4.10
|
598
598
|
signing_key:
|
599
599
|
specification_version: 4
|
600
600
|
summary: Ruby client for split SDK.
|