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 +4 -4
- data/README.md +1 -1
- data/lib/isomorfeus/hamster/marshal.rb +18 -10
- data/lib/isomorfeus/hamster/version.rb +1 -1
- data/lib/isomorfeus-hamster.rb +1 -0
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e186ba78fcf4810b5663570e71e59670c84cc5ac69cc7f763a6bf69fbf69ea6c
|
4
|
+
data.tar.gz: 4b782b907c2912b0dd0bf41465a3d892e8df58a70fe1a54efa9deb0cd9720e95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d15d65f4fe1bb5a5676c5e87d6037ea331f4652d7b83fdc968a2e9e9567fa3f1d4cf3d98bc5ff51b4c61448e7655fede3b8c19b596d1ffdef35db4265f018aea
|
7
|
+
data.tar.gz: 59f4df54ec87985d09a988057112279ee573a5628540f2d30d25261913f1f046cbd0d63ef76a0488dc624425c7f77af24dc9828d83452102b005401d5d17ab8f
|
data/README.md
CHANGED
@@ -2,22 +2,30 @@ 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
|
-
def load(db, key)
|
10
|
-
|
11
|
-
return nil unless
|
12
|
-
::
|
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(
|
20
|
-
::
|
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
|
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.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-
|
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:
|
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:
|