multi_json 1.12.0 → 1.12.1

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: 26886d50e3fa311fe1b33a1d8ebaad6c89d372ec
4
- data.tar.gz: 41b704e0b93ce7211fa41e22a547e80d89ff067c
3
+ metadata.gz: a225eae18c744a8c77819d37dbacdd8147dcdfab
4
+ data.tar.gz: 9cb4b5e29fcf1feef6a1c1841c2d8ee4bc735d46
5
5
  SHA512:
6
- metadata.gz: ed17f8464c34c9dd2feff7decdd12c7c3161434a124c82151c3c167fdcb9d8ff5df5b02eb348d6c06eafe1ef717831780c607432b7f33a192b0c18c329c88558
7
- data.tar.gz: a0cf57eb1318c0d6fe9c790cc82616172be1f6e18d4e7cac8ac100c468455b0a2fa5f078caa44e7de11f605c7795358f443a4145dcee6070450d699ed9c0955e
6
+ metadata.gz: cab3829af47fac93c9ac09666e8eff4ba707b4f86d989abb03bb3e7329744e753290208c103c7fc8592cc87aef33d98cd01c0c5745f8de5faf8b52782d0ea22f
7
+ data.tar.gz: 9eb391a648d7addd9135f08ab673b5127c69f3af6c2d2f77099652a966ea3adc8c022ba48b5346111252b0b7b2a26e931f0d92f39d6a0fa32ce60432191fa69d
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,8 @@
1
+ 1.12.1
2
+ ------
3
+
4
+ * [Prevent meory leak in OptionsCache](https://github.com/intridea/multi_json/commit/aa7498199ad272f3d4a13750d7c568a66047e2ee)
5
+
1
6
  1.12.0
2
7
  ------
3
8
 
data/README.md CHANGED
@@ -74,7 +74,7 @@ implementations:
74
74
  * Ruby 2.0.0
75
75
  * Ruby 2.1
76
76
  * Ruby 2.2.4
77
- * Ruby 2.3.0
77
+ * Ruby 2.3.1
78
78
  * [JRuby][]
79
79
  * [Rubinius][]
80
80
  * [MacRuby][] (not tested on Travis CI)
@@ -9,7 +9,21 @@ module MultiJson
9
9
 
10
10
  def fetch(type, key)
11
11
  cache = instance_variable_get("@#{type}_cache")
12
- cache.key?(key) ? cache[key] : cache[key] = yield
12
+ cache.key?(key) ? cache[key] : write(cache, key, &Proc.new)
13
+ end
14
+
15
+ private
16
+
17
+ # Normally MultiJson is used with a few option sets for both dump/load
18
+ # methods. When options are generated dynamically though, every call would
19
+ # cause a cache miss and the cache would grow indefinitely. To prevent
20
+ # this, we just reset the cache every time the number of keys outgrows
21
+ # 1000.
22
+ MAX_CACHE_SIZE = 1000
23
+
24
+ def write(cache, key)
25
+ cache.clear if cache.length >= MAX_CACHE_SIZE
26
+ cache[key] = yield
13
27
  end
14
28
  end
15
29
  end
@@ -2,7 +2,7 @@ module MultiJson
2
2
  class Version
3
3
  MAJOR = 1 unless defined? MultiJson::Version::MAJOR
4
4
  MINOR = 12 unless defined? MultiJson::Version::MINOR
5
- PATCH = 0 unless defined? MultiJson::Version::PATCH
5
+ PATCH = 1 unless defined? MultiJson::Version::PATCH
6
6
  PRE = nil unless defined? MultiJson::Version::PRE
7
7
 
8
8
  class << self
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multi_json
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.0
4
+ version: 1.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh
@@ -33,7 +33,7 @@ cert_chain:
33
33
  De8xFEGqLG8vclcTv7gGjDJH5FJTXuwLg41wc8p4ONXEBgLiaC7+S/DVDXWpYxuB
34
34
  akI17ua4eRKTFNvBtzP1802SP1k=
35
35
  -----END CERTIFICATE-----
36
- date: 2016-05-03 00:00:00.000000000 Z
36
+ date: 2016-05-18 00:00:00.000000000 Z
37
37
  dependencies:
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: bundler
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  version: 1.3.5
105
105
  requirements: []
106
106
  rubyforge_project:
107
- rubygems_version: 2.5.2
107
+ rubygems_version: 2.6.4
108
108
  signing_key:
109
109
  specification_version: 4
110
110
  summary: A common interface to multiple JSON libraries.
metadata.gz.sig CHANGED
@@ -1,2 +1 @@
1
- ��M�N��U
2
- w��N�t�} <=\d��bP���q��o4�7z�c��ٻ��vn�蒱J@ӛ_�!Mw���t�O@�����ݑE.�IJT �P�G�y>�f�4}��0�Ѳ��i���T��E�~;5�rD�9RK�~G�X���d�#�9���0����; UX �>5�9�P=2� �%1^s��cB
1
+ {�:����E�VL���?>c4o�p