isomorfeus-hamster 0.6.2 → 0.6.6

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: 8ed1e21f1ffd6c8eb4087ae4f1a0f3eea2cdfa738f292f8b166d543752ee420d
4
- data.tar.gz: d53f1b62077538dd1cc31f615345de3667c43e486491e2a88c5bd7dc2de92304
3
+ metadata.gz: e186ba78fcf4810b5663570e71e59670c84cc5ac69cc7f763a6bf69fbf69ea6c
4
+ data.tar.gz: 4b782b907c2912b0dd0bf41465a3d892e8df58a70fe1a54efa9deb0cd9720e95
5
5
  SHA512:
6
- metadata.gz: a348c30b93280fe881efc30ca41924f3571b71c52d432d2621b9a910df327b9380ba084ef51fc97c3123967736e41abbf259e62bd91ef4ce2193b6b3090aac1c
7
- data.tar.gz: 61199533d946849ac8964e15aa268042e07af089efe89c002f3fc27d731d5c9dfefd27df2a4e3d8ba6aabd381e3eaf58509429a1700f22e546019dc92b56ccc1
6
+ metadata.gz: d15d65f4fe1bb5a5676c5e87d6037ea331f4652d7b83fdc968a2e9e9567fa3f1d4cf3d98bc5ff51b4c61448e7655fede3b8c19b596d1ffdef35db4265f018aea
7
+ data.tar.gz: 59f4df54ec87985d09a988057112279ee573a5628540f2d30d25261913f1f046cbd0d63ef76a0488dc624425c7f77af24dc9828d83452102b005401d5d17ab8f
data/README.md CHANGED
@@ -7,4 +7,4 @@
7
7
  Convenient and well performing key value store and object database.
8
8
 
9
9
  ### Community and Support
10
- At the [Isomorfeus Framework Project](http://isomorfeus.com)
10
+ At the [Isomorfeus Framework Project](https://isomorfeus.com)
@@ -2,22 +2,30 @@ module Isomorfeus
2
2
  module Hamster
3
3
  module Marshal
4
4
  class << self
5
- def dump(db, key, obj)
6
- db.env.transaction { db.put(key, ::Oj.dump(obj)) }
5
+ BROTLI = 'b:'.freeze
6
+
7
+ def dump(db, key, obj, class_cache: true, compress: false)
8
+ v = ::Oj.dump(obj, mode: :object, circular: true, class_cache: class_cache)
9
+ v = 'b:' << ::Brotli.deflate(v, quality: compress) if compress
10
+ db.env.transaction { db.put(key, v) }
7
11
  end
8
12
 
9
- def load(db, key)
10
- obj_j = db.get(key)
11
- return nil unless obj_j
12
- ::Oj.load(obj_j)
13
+ def load(db, key, class_cache: true)
14
+ v = db.get(key)
15
+ return nil unless v
16
+ v = ::Brotli.inflate(v[2..]) if v.start_with?(BROTLI)
17
+ ::Oj.load(v, mode: :object, circular: true, class_cache: class_cache)
13
18
  end
14
19
 
15
- def serialize(obj)
16
- ::Oj.dump(obj)
20
+ def serialize(obj, class_cache: true, compress: false)
21
+ v = ::Oj.dump(obj, mode: :object, circular: true, class_cache: class_cache)
22
+ v = 'b:' << ::Brotli.deflate(v, quality: compress) if compress
23
+ v
17
24
  end
18
25
 
19
- def unserialize(obj_j)
20
- ::Oj.load(obj_j)
26
+ def unserialize(v, class_cache: true)
27
+ v = ::Brotli.inflate(v[2..]) if v.start_with?(BROTLI)
28
+ ::Oj.load(v, mode: :object, circular: true, class_cache: class_cache)
21
29
  end
22
30
  end
23
31
  end
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module Hamster
3
- VERSION = '0.6.2'
3
+ VERSION = '0.6.6'
4
4
  end
5
5
  end
@@ -1,3 +1,4 @@
1
+ require 'brotli'
1
2
  require 'oj'
2
3
  require 'isomorfeus_hamster_ext'
3
4
  require 'isomorfeus/hamster/version'
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isomorfeus-hamster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-01 00:00:00.000000000 Z
11
+ date: 2022-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: brotli
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.4.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.4.0
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: oj
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -98,11 +112,12 @@ files:
98
112
  - lib/isomorfeus/hamster/database.rb
99
113
  - lib/isomorfeus/hamster/marshal.rb
100
114
  - lib/isomorfeus/hamster/version.rb
101
- homepage: http://isomorfeus.com
115
+ homepage: https://isomorfeus.com
102
116
  licenses:
103
117
  - MIT
104
118
  metadata:
105
119
  github_repo: ssh://github.com/isomorfeus/gems
120
+ source_code_uri: https://github.com/isomorfeus/isomorfeus-hamster
106
121
  post_install_message:
107
122
  rdoc_options: []
108
123
  require_paths: