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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/lib/multi_json/options_cache.rb +15 -1
- data/lib/multi_json/version.rb +1 -1
- metadata +3 -3
- metadata.gz.sig +1 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a225eae18c744a8c77819d37dbacdd8147dcdfab
|
4
|
+
data.tar.gz: 9cb4b5e29fcf1feef6a1c1841c2d8ee4bc735d46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cab3829af47fac93c9ac09666e8eff4ba707b4f86d989abb03bb3e7329744e753290208c103c7fc8592cc87aef33d98cd01c0c5745f8de5faf8b52782d0ea22f
|
7
|
+
data.tar.gz: 9eb391a648d7addd9135f08ab673b5127c69f3af6c2d2f77099652a966ea3adc8c022ba48b5346111252b0b7b2a26e931f0d92f39d6a0fa32ce60432191fa69d
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -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
|
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
|
data/lib/multi_json/version.rb
CHANGED
@@ -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 =
|
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.
|
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-
|
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.
|
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
|
-
|
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
|