isomorfeus-hamster 0.6.4 → 0.6.5

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: c0a62ae4a77a996b8dc257b1f39600f1c90a2903765fb495a8ae47e70ba961c7
4
- data.tar.gz: 3fd95f68beed49e13b4f2c3dc13ffc97d9ad48beb3b62822e232c1781aee5f59
3
+ metadata.gz: 3e47bdc930e499583d4d07732990944617d8b1cf87b8694f846a060b0ec864b5
4
+ data.tar.gz: 3e9561cc9748cda8b494d056853f9c5c4c6a621c48523554a20b4ce4b61935ab
5
5
  SHA512:
6
- metadata.gz: aa0b2b6738eab73e3ceb690ad5fdaa8a90e2046ff6a2429dded499afe78d3286a14ec9a9a7bfae03d78a78f685b9ba24abcb84b4e276b2fb2820b59d573f8405
7
- data.tar.gz: d59d6b728565ea92591f49eb49f0c8228bcf1423fe052de117dc3b24c5f97dc70f502a7a96b422aa5fc9a8385844add878ff755745f91535fa756e664fdbf16c
6
+ metadata.gz: 7cbcc1820f97759384a868fd3af9003a706d6cc3291d1b6e06cee417c00c7f0b7ac270ba887e2fc9802963ad94474809faa8f1a2ec03f408a988532a5f36ebe9
7
+ data.tar.gz: 9789b1d1116bd0081cdc656491ef95a7f357e8ad4ad647081afd2ac5251bfd7328bbd3c26873abb4245554078132dc910f99907981c606b061d08576c901d22f
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,27 @@ module Isomorfeus
2
2
  module Hamster
3
3
  module Marshal
4
4
  class << self
5
- def dump(db, key, obj, class_cache: true)
6
- db.env.transaction { db.put(key, ::Oj.dump(obj, mode: :object, class_cache: class_cache)) }
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
13
  def load(db, key, class_cache: true)
10
- obj_j = db.get(key)
11
- return nil unless obj_j
12
- ::Oj.load(obj_j, mode: :object, class_cache: class_cache)
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
20
  def serialize(obj, class_cache: true)
16
- ::Oj.dump(obj, mode: :object, class_cache: class_cache)
21
+ ::Oj.dump(obj, mode: :object, circular: true, class_cache: class_cache)
17
22
  end
18
23
 
19
24
  def unserialize(obj_j, class_cache: true)
20
- ::Oj.load(obj_j, mode: :object, class_cache: class_cache)
25
+ ::Oj.load(obj_j, mode: :object, circular: true, class_cache: class_cache)
21
26
  end
22
27
  end
23
28
  end
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module Hamster
3
- VERSION = '0.6.4'
3
+ VERSION = '0.6.5'
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.4
4
+ version: 0.6.5
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-08 00:00:00.000000000 Z
11
+ date: 2022-02-18 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,7 +112,7 @@ 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: