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 +4 -4
- data/README.md +1 -1
- data/lib/isomorfeus/hamster/marshal.rb +12 -7
- data/lib/isomorfeus/hamster/version.rb +1 -1
- data/lib/isomorfeus-hamster.rb +1 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e47bdc930e499583d4d07732990944617d8b1cf87b8694f846a060b0ec864b5
|
4
|
+
data.tar.gz: 3e9561cc9748cda8b494d056853f9c5c4c6a621c48523554a20b4ce4b61935ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cbcc1820f97759384a868fd3af9003a706d6cc3291d1b6e06cee417c00c7f0b7ac270ba887e2fc9802963ad94474809faa8f1a2ec03f408a988532a5f36ebe9
|
7
|
+
data.tar.gz: 9789b1d1116bd0081cdc656491ef95a7f357e8ad4ad647081afd2ac5251bfd7328bbd3c26873abb4245554078132dc910f99907981c606b061d08576c901d22f
|
data/README.md
CHANGED
@@ -2,22 +2,27 @@ module Isomorfeus
|
|
2
2
|
module Hamster
|
3
3
|
module Marshal
|
4
4
|
class << self
|
5
|
-
|
6
|
-
|
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
|
-
|
11
|
-
return nil unless
|
12
|
-
::
|
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
|
data/lib/isomorfeus-hamster.rb
CHANGED
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
|
+
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-
|
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:
|
115
|
+
homepage: https://isomorfeus.com
|
102
116
|
licenses:
|
103
117
|
- MIT
|
104
118
|
metadata:
|