moneta 1.4.2 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +35 -38
- data/CHANGES +9 -0
- data/CONTRIBUTORS +2 -0
- data/Gemfile +143 -55
- data/README.md +5 -4
- data/lib/moneta/adapter.rb +52 -0
- data/lib/moneta/adapters/activerecord.rb +77 -68
- data/lib/moneta/adapters/activesupportcache.rb +22 -31
- data/lib/moneta/adapters/cassandra.rb +114 -116
- data/lib/moneta/adapters/client.rb +17 -18
- data/lib/moneta/adapters/couch.rb +31 -26
- data/lib/moneta/adapters/datamapper.rb +9 -5
- data/lib/moneta/adapters/daybreak.rb +15 -21
- data/lib/moneta/adapters/dbm.rb +6 -12
- data/lib/moneta/adapters/file.rb +21 -13
- data/lib/moneta/adapters/fog.rb +5 -6
- data/lib/moneta/adapters/gdbm.rb +6 -12
- data/lib/moneta/adapters/hbase.rb +10 -12
- data/lib/moneta/adapters/kyotocabinet.rb +22 -27
- data/lib/moneta/adapters/leveldb.rb +14 -20
- data/lib/moneta/adapters/lmdb.rb +19 -22
- data/lib/moneta/adapters/localmemcache.rb +7 -13
- data/lib/moneta/adapters/lruhash.rb +20 -20
- data/lib/moneta/adapters/memcached/dalli.rb +25 -33
- data/lib/moneta/adapters/memcached/native.rb +14 -20
- data/lib/moneta/adapters/memory.rb +5 -7
- data/lib/moneta/adapters/mongo.rb +53 -52
- data/lib/moneta/adapters/pstore.rb +21 -27
- data/lib/moneta/adapters/redis.rb +42 -37
- data/lib/moneta/adapters/restclient.rb +17 -25
- data/lib/moneta/adapters/riak.rb +8 -9
- data/lib/moneta/adapters/sdbm.rb +6 -12
- data/lib/moneta/adapters/sequel/mysql.rb +8 -8
- data/lib/moneta/adapters/sequel/postgres.rb +17 -17
- data/lib/moneta/adapters/sequel/postgres_hstore.rb +47 -47
- data/lib/moneta/adapters/sequel/sqlite.rb +9 -9
- data/lib/moneta/adapters/sequel.rb +56 -65
- data/lib/moneta/adapters/sqlite.rb +37 -35
- data/lib/moneta/adapters/tdb.rb +8 -14
- data/lib/moneta/adapters/tokyocabinet.rb +19 -17
- data/lib/moneta/adapters/tokyotyrant.rb +29 -30
- data/lib/moneta/adapters/yaml.rb +1 -5
- data/lib/moneta/config.rb +101 -0
- data/lib/moneta/expires.rb +0 -1
- data/lib/moneta/expires_support.rb +3 -4
- data/lib/moneta/pool.rb +1 -1
- data/lib/moneta/proxy.rb +29 -0
- data/lib/moneta/server.rb +21 -14
- data/lib/moneta/version.rb +1 -1
- data/lib/moneta/wrapper.rb +5 -0
- data/lib/moneta.rb +2 -0
- data/moneta.gemspec +1 -0
- data/spec/moneta/adapters/client/client_helper.rb +4 -3
- data/spec/moneta/adapters/faraday_helper.rb +3 -2
- data/spec/moneta/adapters/lruhash/adapter_lruhash_spec.rb +10 -6
- data/spec/moneta/adapters/mongo/adapter_mongo_spec.rb +2 -2
- data/spec/moneta/config_spec.rb +219 -0
- data/spec/moneta/proxies/transformer/transformer_bson_spec.rb +3 -1
- data/spec/moneta/proxies/transformer/transformer_marshal_escape_spec.rb +2 -0
- data/spec/rack/session_moneta_spec.rb +44 -25
- data/spec/restserver.rb +3 -14
- metadata +24 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67e7a85926fad89dd255f180a3455b67c923d0194d447a8fe82cca0dbb546bbe
|
4
|
+
data.tar.gz: 51e15e0e3e1bafd312ee62d807afb72836e4f5c3cc036dc8c1ee0dcb8d51f80a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc4340a0c94ce262108361a3ed49116980cc0ee94838810babe5015bb43d3084875fa3e76f232b182470dda6a5ab9ac7e09fe9917a97082047ec9d0b7112a02a
|
7
|
+
data.tar.gz: a0f1c197e3222848e246bf0535805b4dd47bf8dbf9b3a383c619e187cb9b6d64ac6de4f711190630b4befac1e820061fd66a04d83a529a01bee519fbcde4af23
|
data/.github/workflows/ruby.yml
CHANGED
@@ -2,9 +2,9 @@ name: Ruby CI
|
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
5
|
-
branches: [
|
5
|
+
branches: [ main ]
|
6
6
|
pull_request:
|
7
|
-
branches: [
|
7
|
+
branches: [ main ]
|
8
8
|
|
9
9
|
jobs:
|
10
10
|
adapters:
|
@@ -14,7 +14,7 @@ jobs:
|
|
14
14
|
fail-fast: false
|
15
15
|
|
16
16
|
matrix:
|
17
|
-
ruby-version: [2.7, 2.6, 2.5, 2.4,
|
17
|
+
ruby-version: [2.7, 2.6, 2.5, 2.4, jruby]
|
18
18
|
adapter:
|
19
19
|
- Client
|
20
20
|
- Cookie
|
@@ -42,7 +42,7 @@ jobs:
|
|
42
42
|
- YAML
|
43
43
|
|
44
44
|
env:
|
45
|
-
|
45
|
+
BUNDLE_WITH: ${{ matrix.adapter }} snappy
|
46
46
|
|
47
47
|
steps:
|
48
48
|
- uses: actions/checkout@v2
|
@@ -51,7 +51,7 @@ jobs:
|
|
51
51
|
run: sudo apt-get update
|
52
52
|
|
53
53
|
- name: Apt install dependencies
|
54
|
-
run: sudo apt-get install -y libkyotocabinet-dev libleveldb-dev
|
54
|
+
run: sudo apt-get install -y libkyotocabinet-dev libleveldb-dev libtdb-dev libtokyocabinet-dev tokyotyrant libgdbm-dev
|
55
55
|
|
56
56
|
- name: Set up Ruby ${{ matrix.ruby-version }}
|
57
57
|
uses: ruby/setup-ruby@v1
|
@@ -61,7 +61,7 @@ jobs:
|
|
61
61
|
bundler-cache: true
|
62
62
|
|
63
63
|
- name: Rspec
|
64
|
-
run: bundle exec rspec -t ~unstable -t adapter:${{ matrix.adapter }}
|
64
|
+
run: bundle exec rspec -t ~unstable -t adapter:${{ matrix.adapter }} -- spec/moneta
|
65
65
|
|
66
66
|
couch:
|
67
67
|
name: "Couch adapter"
|
@@ -83,10 +83,10 @@ jobs:
|
|
83
83
|
|
84
84
|
strategy:
|
85
85
|
matrix:
|
86
|
-
ruby-version: [2.7, 2.
|
86
|
+
ruby-version: [2.7, 2.4, jruby]
|
87
87
|
|
88
88
|
env:
|
89
|
-
|
89
|
+
BUNDLE_WITH: RestClient
|
90
90
|
|
91
91
|
steps:
|
92
92
|
- uses: actions/checkout@v2
|
@@ -99,7 +99,7 @@ jobs:
|
|
99
99
|
bundler-cache: true
|
100
100
|
|
101
101
|
- name: Rspec
|
102
|
-
run: bundle exec rspec -t adapter:Couch
|
102
|
+
run: bundle exec rspec -t adapter:Couch -- spec/moneta
|
103
103
|
|
104
104
|
cassandra:
|
105
105
|
name: "Cassandra adapter"
|
@@ -111,17 +111,17 @@ jobs:
|
|
111
111
|
options: >-
|
112
112
|
--health-cmd "cqlsh -e \"SELECT cql_version FROM system.local\""
|
113
113
|
--health-interval 10s
|
114
|
-
--health-timeout
|
115
|
-
--health-retries
|
114
|
+
--health-timeout 10s
|
115
|
+
--health-retries 10
|
116
116
|
ports:
|
117
117
|
- 9042:9042
|
118
118
|
|
119
119
|
strategy:
|
120
120
|
matrix:
|
121
|
-
ruby-version: [2.7, 2.
|
121
|
+
ruby-version: [2.7, 2.4, jruby]
|
122
122
|
|
123
123
|
env:
|
124
|
-
|
124
|
+
BUNDLE_WITH: Cassandra
|
125
125
|
|
126
126
|
steps:
|
127
127
|
- uses: actions/checkout@v2
|
@@ -134,7 +134,7 @@ jobs:
|
|
134
134
|
bundler-cache: true
|
135
135
|
|
136
136
|
- name: Rspec
|
137
|
-
run: bundle exec rspec -t adapter:Cassandra
|
137
|
+
run: bundle exec rspec -t adapter:Cassandra -- spec/moneta
|
138
138
|
|
139
139
|
mysql-adapters:
|
140
140
|
name: "MySQL adapters"
|
@@ -158,7 +158,7 @@ jobs:
|
|
158
158
|
ruby-version: [2.7, 2.4, jruby]
|
159
159
|
|
160
160
|
env:
|
161
|
-
|
161
|
+
BUNDLE_WITH: ActiveRecord Sequel DataMapper mysql
|
162
162
|
MYSQL_HOST: 127.0.0.1
|
163
163
|
MONETA_MYSQL_PASSWORD: moneta
|
164
164
|
|
@@ -189,7 +189,7 @@ jobs:
|
|
189
189
|
bundler-cache: true
|
190
190
|
|
191
191
|
- name: Rspec
|
192
|
-
run: bundle exec rspec -t mysql
|
192
|
+
run: bundle exec rspec -t mysql -- spec/moneta
|
193
193
|
|
194
194
|
postgres-adapters:
|
195
195
|
name: "Postgres adapters"
|
@@ -197,7 +197,7 @@ jobs:
|
|
197
197
|
|
198
198
|
services:
|
199
199
|
postgres:
|
200
|
-
image: postgres
|
200
|
+
image: postgres:13.6
|
201
201
|
env:
|
202
202
|
POSTGRES_PASSWORD: moneta
|
203
203
|
options: >-
|
@@ -210,10 +210,10 @@ jobs:
|
|
210
210
|
|
211
211
|
strategy:
|
212
212
|
matrix:
|
213
|
-
ruby-version: [2.7, 2.
|
213
|
+
ruby-version: [2.7, 2.4, jruby]
|
214
214
|
|
215
215
|
env:
|
216
|
-
|
216
|
+
BUNDLE_WITH: ActiveRecord Sequel DataMapper postgresql
|
217
217
|
PGHOST: localhost
|
218
218
|
PGUSER: postgres
|
219
219
|
PGPASSWORD: moneta
|
@@ -238,7 +238,7 @@ jobs:
|
|
238
238
|
bundler-cache: true
|
239
239
|
|
240
240
|
- name: Rspec
|
241
|
-
run: bundle exec rspec -t postgres
|
241
|
+
run: bundle exec rspec -t postgres -- spec/moneta
|
242
242
|
|
243
243
|
sqlite-adapters:
|
244
244
|
name: "SQLite adapters"
|
@@ -246,10 +246,10 @@ jobs:
|
|
246
246
|
|
247
247
|
strategy:
|
248
248
|
matrix:
|
249
|
-
ruby-version: [2.7, 2.
|
249
|
+
ruby-version: [2.7, 2.4, jruby]
|
250
250
|
|
251
251
|
env:
|
252
|
-
|
252
|
+
BUNDLE_WITH: ActiveRecord Sequel DataMapper sqlite
|
253
253
|
|
254
254
|
steps:
|
255
255
|
- uses: actions/checkout@v2
|
@@ -262,7 +262,7 @@ jobs:
|
|
262
262
|
bundler-cache: true
|
263
263
|
|
264
264
|
- name: Rspec
|
265
|
-
run: bundle exec rspec -t sqlite
|
265
|
+
run: bundle exec rspec -t sqlite -- spec/moneta
|
266
266
|
|
267
267
|
redis:
|
268
268
|
name: "Redis adapters"
|
@@ -281,10 +281,10 @@ jobs:
|
|
281
281
|
|
282
282
|
strategy:
|
283
283
|
matrix:
|
284
|
-
ruby-version: [2.7, 2.
|
284
|
+
ruby-version: [2.7, 2.4, jruby]
|
285
285
|
|
286
286
|
env:
|
287
|
-
|
287
|
+
BUNDLE_WITH: Redis
|
288
288
|
|
289
289
|
steps:
|
290
290
|
- uses: actions/checkout@v2
|
@@ -297,7 +297,7 @@ jobs:
|
|
297
297
|
bundler-cache: true
|
298
298
|
|
299
299
|
- name: Rspec
|
300
|
-
run: bundle exec rspec -t adapter:Redis -t redis
|
300
|
+
run: bundle exec rspec -t adapter:Redis -t redis -- spec/moneta
|
301
301
|
|
302
302
|
memcached:
|
303
303
|
name: "Memcached adapters"
|
@@ -305,10 +305,10 @@ jobs:
|
|
305
305
|
|
306
306
|
strategy:
|
307
307
|
matrix:
|
308
|
-
ruby-version: [2.7, 2.
|
308
|
+
ruby-version: [2.7, 2.4, jruby]
|
309
309
|
|
310
310
|
env:
|
311
|
-
|
311
|
+
BUNDLE_WITH: Memcached
|
312
312
|
|
313
313
|
steps:
|
314
314
|
- uses: actions/checkout@v2
|
@@ -327,7 +327,7 @@ jobs:
|
|
327
327
|
bundler-cache: true
|
328
328
|
|
329
329
|
- name: Rspec
|
330
|
-
run: bundle exec rspec -t ~unstable -t adapter:Memcached -t memcached
|
330
|
+
run: bundle exec rspec -t ~unstable -t adapter:Memcached -t memcached -- spec/moneta
|
331
331
|
|
332
332
|
mongo:
|
333
333
|
name: "Mongo adapter"
|
@@ -346,10 +346,10 @@ jobs:
|
|
346
346
|
|
347
347
|
strategy:
|
348
348
|
matrix:
|
349
|
-
ruby-version: [2.7, 2.
|
349
|
+
ruby-version: [2.7, 2.4] #, jruby] - FIXME reenable once https://github.com/mongodb/mongo-ruby-driver/pull/2143 is released
|
350
350
|
|
351
351
|
env:
|
352
|
-
|
352
|
+
BUNDLE_WITH: Mongo
|
353
353
|
|
354
354
|
steps:
|
355
355
|
- uses: actions/checkout@v2
|
@@ -362,7 +362,7 @@ jobs:
|
|
362
362
|
bundler-cache: true
|
363
363
|
|
364
364
|
- name: Rspec
|
365
|
-
run: bundle exec rspec -t adapter:Mongo
|
365
|
+
run: bundle exec rspec -t adapter:Mongo -- spec/moneta
|
366
366
|
|
367
367
|
residual-specs:
|
368
368
|
name: "Proxies and other specs"
|
@@ -370,10 +370,10 @@ jobs:
|
|
370
370
|
|
371
371
|
strategy:
|
372
372
|
matrix:
|
373
|
-
ruby-version: [2.7, 2.
|
373
|
+
ruby-version: [2.7, 2.4, jruby]
|
374
374
|
|
375
375
|
env:
|
376
|
-
|
376
|
+
BUNDLE_WITH: transformers GDBM Fog
|
377
377
|
|
378
378
|
steps:
|
379
379
|
- uses: actions/checkout@v2
|
@@ -382,7 +382,7 @@ jobs:
|
|
382
382
|
run: sudo apt-get update
|
383
383
|
|
384
384
|
- name: Apt install dependencies
|
385
|
-
run: sudo apt-get install -y libgdbm-dev
|
385
|
+
run: sudo apt-get install -y libgdbm-dev liblzo2-dev
|
386
386
|
|
387
387
|
- name: Set up Ruby ${{ matrix.ruby-version }}
|
388
388
|
uses: ruby/setup-ruby@v1
|
@@ -401,9 +401,6 @@ jobs:
|
|
401
401
|
name: "Rubocop"
|
402
402
|
runs-on: ubuntu-latest
|
403
403
|
|
404
|
-
env:
|
405
|
-
BUNDLE_WITHOUT: activerecord riak couch cassandra postgresql mysql datamapper memcached_native redis leveldb
|
406
|
-
|
407
404
|
steps:
|
408
405
|
- uses: actions/checkout@v2
|
409
406
|
|
data/CHANGES
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
1.5.0
|
2
|
+
|
3
|
+
* Adapters - internally, most (all?) adapters now inherit from a base Adapter class
|
4
|
+
* Adapters - adapter configuration is now accessed via a `config` method on
|
5
|
+
each adapter - see the code for examples. This shouldn't affect
|
6
|
+
users unless they were directly modifying adapters' attributes.
|
7
|
+
* Redis - fix deprecation warnings for Redis 4.6+ multi/pipelined handling (#215)
|
8
|
+
* Mongo - slight improvement to error handling
|
9
|
+
|
1
10
|
1.4.2
|
2
11
|
|
3
12
|
* Pool - fix busy-loop issue (#197)
|
data/CONTRIBUTORS
CHANGED
@@ -3,6 +3,7 @@ Alastair Pharo <me@asph.dev>
|
|
3
3
|
Alejandro Crosa <acrosa@sharing.local>
|
4
4
|
Alessio Signorini <alessio@signorini.us>
|
5
5
|
Anthony Eden <anthonyeden@gmail.com>
|
6
|
+
Antonio Terceiro <terceiro@debian.org>
|
6
7
|
Atoxhybrid <atoxhybrid@gmail.com>
|
7
8
|
AtoxIO <atoxhybrid@gmail.com>
|
8
9
|
Ben Schwarz <ben.schwarz@gmail.com>
|
@@ -32,6 +33,7 @@ Potapov Sergey <blake131313@gmail.com>
|
|
32
33
|
Quin Hoxie <quin@aboutus.org>
|
33
34
|
Ryan T. Hosford <tad.hosford@gmail.com>
|
34
35
|
Scott Wadden <scott.wadden@gmail.com>
|
36
|
+
Sven Riedel <sr@gimp.org>
|
35
37
|
Timo Goebel <timo.goebel@dm.de>
|
36
38
|
Tom Meier <ozmeier@yahoo.co.uk>
|
37
39
|
Tony Han <h.bing612@gmail.com>
|
data/Gemfile
CHANGED
@@ -1,86 +1,174 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
gemspec
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
gem '
|
7
|
-
|
4
|
+
group :transformers, optional: true do
|
5
|
+
group :tnet, optional: true do
|
6
|
+
gem 'tnetstring'
|
7
|
+
end
|
8
|
+
|
9
|
+
group :bencode, optional: true do
|
10
|
+
gem 'bencode'
|
11
|
+
end
|
12
|
+
|
13
|
+
group :ox, optional: true do
|
14
|
+
gem 'ox', platforms: :ruby
|
15
|
+
end
|
16
|
+
|
17
|
+
group :bert, optional: true do
|
18
|
+
gem 'bert', platforms: :ruby
|
19
|
+
end
|
20
|
+
|
21
|
+
group :php, optional: true do
|
22
|
+
gem 'php-serialize'
|
23
|
+
end
|
24
|
+
|
25
|
+
group :bson, optional: true do
|
26
|
+
gem 'bson', '>= 4.0.0'
|
27
|
+
end
|
28
|
+
|
29
|
+
group :msgpack, optional: true do
|
30
|
+
gem 'msgpack', platforms: :ruby
|
31
|
+
gem 'msgpack-jruby', platforms: :jruby
|
32
|
+
end
|
33
|
+
|
34
|
+
# Compressors used by Transformer
|
35
|
+
group :bzip2, optional: true do
|
36
|
+
gem 'rbzip2', '>= 0.3.0'
|
37
|
+
end
|
38
|
+
|
39
|
+
group :lz4, optional: true do
|
40
|
+
gem 'lz4-ruby', platforms: :ruby
|
41
|
+
end
|
42
|
+
|
43
|
+
group :lzma, optional: true do
|
44
|
+
gem 'ruby-lzma', platforms: :ruby
|
45
|
+
end
|
46
|
+
|
47
|
+
group :lzo, optional: true do
|
48
|
+
gem 'lzoruby', platforms: :ruby
|
49
|
+
end
|
50
|
+
|
51
|
+
group :snappy, optional: true do
|
52
|
+
gem 'snappy', platforms: :ruby
|
53
|
+
end
|
54
|
+
|
55
|
+
group :quicklz, optional: true do
|
56
|
+
gem 'qlzruby', platforms: :ruby
|
57
|
+
end
|
58
|
+
|
59
|
+
# Hash transformer library
|
60
|
+
group :city, optional: true do
|
61
|
+
gem 'cityhash', platforms: :ruby
|
62
|
+
end
|
63
|
+
end
|
8
64
|
|
9
|
-
#
|
10
|
-
|
11
|
-
gem '
|
12
|
-
|
13
|
-
gem 'bert', platforms: :ruby, group: :bert
|
14
|
-
gem 'php-serialize', group: :php
|
65
|
+
# Backends
|
66
|
+
group :Daybreak, optional: true do
|
67
|
+
gem 'daybreak'
|
68
|
+
end
|
15
69
|
|
16
|
-
group :
|
17
|
-
gem '
|
70
|
+
group :ActiveRecord, optional: true do
|
71
|
+
gem 'activerecord', '~> 5.2'
|
18
72
|
end
|
19
73
|
|
20
|
-
group :
|
21
|
-
gem '
|
22
|
-
gem 'msgpack-jruby', platforms: :jruby
|
74
|
+
group :Redis, optional: true do
|
75
|
+
gem 'redis', '~> 4.2'
|
23
76
|
end
|
24
77
|
|
25
|
-
|
26
|
-
gem '
|
27
|
-
|
28
|
-
gem 'ruby-lzma', platforms: :ruby, group: :lzma
|
29
|
-
gem 'lzoruby', platforms: :ruby, group: :lzo
|
30
|
-
gem 'snappy', platforms: :ruby, group: :snappy
|
31
|
-
gem 'qlzruby', platforms: :ruby, group: :quicklz
|
78
|
+
group :Mongo, optional: true do
|
79
|
+
gem 'mongo', '>= 2'
|
80
|
+
end
|
32
81
|
|
33
|
-
|
34
|
-
gem '
|
82
|
+
group :Sequel, optional: true do
|
83
|
+
gem 'sequel', '5.52.0'
|
84
|
+
end
|
35
85
|
|
36
|
-
|
37
|
-
|
38
|
-
gem '
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
gem '
|
43
|
-
gem '
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
gem '
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
gem '
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
gem '
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
86
|
+
group :Memcached, optional: true do
|
87
|
+
group :MemcachedDalli, optional: true do
|
88
|
+
gem 'dalli', '~> 2.7.11'
|
89
|
+
end
|
90
|
+
|
91
|
+
group :MemcachedNative, optional: true do
|
92
|
+
gem 'memcached', platforms: :ruby
|
93
|
+
gem 'jruby-memcached', platforms: :jruby
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
group :Riak, optional: true do
|
98
|
+
gem 'riak-client'
|
99
|
+
end
|
100
|
+
|
101
|
+
group :Cassandra, optional: true do
|
102
|
+
gem 'cassandra-driver'
|
103
|
+
end
|
104
|
+
|
105
|
+
group :TokyoTyrant, optional: true do
|
106
|
+
gem 'tokyotyrant'
|
107
|
+
end
|
108
|
+
|
109
|
+
group :HBase, optional: true do
|
110
|
+
gem 'hbaserb'
|
111
|
+
end
|
112
|
+
|
113
|
+
group :LocalMemCache, optional: true do
|
114
|
+
gem 'localmemcache', platforms: :ruby
|
115
|
+
end
|
116
|
+
|
117
|
+
group :TDB, optional: true do
|
118
|
+
gem 'tdb', platforms: :ruby
|
119
|
+
end
|
120
|
+
|
121
|
+
group :LevelDB, optional: true do
|
122
|
+
gem 'leveldb-ruby', platforms: :ruby
|
123
|
+
end
|
124
|
+
|
125
|
+
group :LMDB, optional: true do
|
126
|
+
gem 'lmdb', platforms: :mri
|
127
|
+
end
|
128
|
+
|
129
|
+
group :TokyoCabinet, optional: true do
|
130
|
+
gem 'tokyocabinet', platforms: :ruby
|
131
|
+
end
|
132
|
+
|
133
|
+
group :KyotoCabinet, optional: true do
|
134
|
+
gem 'kyotocabinet-ruby-reanimated', platforms: [:ruby_23, :ruby_24, :ruby_25, :ruby_26]
|
135
|
+
end
|
136
|
+
|
137
|
+
group :H2, optional: true do
|
138
|
+
gem 'activerecord-jdbch2-adapter', platforms: :jruby, github: 'jruby/activerecord-jdbc-adapter', glob: 'activerecord-jdbch2-adapter/*.gemspec', branch: '52-stable'
|
139
|
+
end
|
140
|
+
|
141
|
+
group :GDBM, optional: true do
|
142
|
+
gem 'ffi-gdbm', platforms: :jruby
|
143
|
+
end
|
144
|
+
|
145
|
+
group :RestClient do
|
146
|
+
gem 'faraday'
|
147
|
+
gem 'webrick'
|
148
|
+
end
|
149
|
+
|
150
|
+
group :DataMapper, optional: true do
|
63
151
|
gem 'dm-core'
|
64
152
|
gem 'dm-migrations'
|
65
153
|
gem 'dm-mysql-adapter'
|
66
154
|
end
|
67
155
|
|
68
|
-
group :
|
156
|
+
group :Fog, optional: true do
|
69
157
|
gem 'fog-aws', '>= 1.11.1'
|
70
158
|
gem 'mime-types'
|
71
159
|
end
|
72
160
|
|
73
|
-
group :mysql do
|
161
|
+
group :mysql, optional: true do
|
74
162
|
gem 'activerecord-jdbcmysql-adapter', platforms: :jruby
|
75
163
|
gem 'mysql2', platforms: :ruby
|
76
164
|
end
|
77
165
|
|
78
|
-
group :sqlite do
|
166
|
+
group :sqlite, optional: true do
|
79
167
|
gem 'activerecord-jdbcsqlite3-adapter', platforms: :jruby
|
80
168
|
gem 'sqlite3', '~> 1.3.6', platforms: :ruby
|
81
169
|
end
|
82
170
|
|
83
|
-
group :postgresql do
|
171
|
+
group :postgresql, optional: true do
|
84
172
|
gem 'activerecord-jdbcpostgresql-adapter', platforms: :jruby
|
85
173
|
gem 'pg', platforms: :ruby
|
86
174
|
end
|
data/README.md
CHANGED
@@ -77,8 +77,8 @@ store.close
|
|
77
77
|
* Tests and benchmarks: <https://github.com/moneta-rb/moneta/actions>
|
78
78
|
* API documentation:
|
79
79
|
* Latest Gem: <http://rubydoc.info/gems/moneta/frames>
|
80
|
-
* GitHub
|
81
|
-
* Changelog: <https://github.com/moneta-rb/moneta/blob/
|
80
|
+
* GitHub main: <http://rubydoc.info/github/moneta-rb/moneta/main/frames>
|
81
|
+
* Changelog: <https://github.com/moneta-rb/moneta/blob/main/CHANGES>
|
82
82
|
|
83
83
|
In case you are wondering, Moneta uses [Semantic Versioning](https://semver.org/) since v1.0.0.
|
84
84
|
|
@@ -135,7 +135,7 @@ to upgrade to a real key/value store.
|
|
135
135
|
|
136
136
|
### Backend feature matrix
|
137
137
|
|
138
|
-
__NOTE:__ <a name="backend-matrix"></a>The backend matrix is much more readable on rubydoc.info than on github. [Go there!](http://rubydoc.info/github/moneta-rb/moneta/
|
138
|
+
__NOTE:__ <a name="backend-matrix"></a>The backend matrix is much more readable on rubydoc.info than on github. [Go there!](http://rubydoc.info/github/moneta-rb/moneta/main/file/README.md#backend-matrix)
|
139
139
|
|
140
140
|
<table>
|
141
141
|
<tr><th>Adapter</th><th>Required gems</th><th style="writing-mode:tb">MRI support<sup>1</sup></th><th style="writing-mode:tb">JRuby support<sup>1</sup></th><th style="writing-mode:tb">Multi-thread safe<sup>2</sup></th><th style="writing-mode:tb">Multi-process safe<sup>3</sup></th><th style="writing-mode:tb">Atomic increment<sup>4</sup></th><th style="writing-mode:tb">Atomic create<sup>5</sup></th><th style="writing-mode:tb">Native expires<sup>6</sup></th><th style="writing-mode:tb">Persistent</th><th style="writing-mode:tb">Key Traversal</th><th style="writing-mode:tb">Bulk read<sup>7</sup></th><th style="writing-mode:tb">Bulk write<sup>8</sup></th><th>Description</th></tr>
|
@@ -912,7 +912,8 @@ Person.adapter :memory, Moneta.new(:Redis)
|
|
912
912
|
## Testing and Benchmarks
|
913
913
|
|
914
914
|
Testing is done using [GitHub Actions](https://github.com/moneta-rb/moneta/actions).
|
915
|
-
Currently we support MRI Ruby >= 2.
|
915
|
+
Currently we support MRI Ruby >= 2.4.0 (but not yet 3.x) and the JRuby >=
|
916
|
+
9.2.9.0. MRI 2.3.0 should mostly still work, but is no longer tested in CI.
|
916
917
|
|
917
918
|
~~Benchmarks for each store are done on
|
918
919
|
[Travis-CI](http://travis-ci.org/moneta-rb/moneta) for each build.~~ At the
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Moneta
|
2
|
+
# Adapter base class
|
3
|
+
# @api public
|
4
|
+
class Adapter
|
5
|
+
include Defaults
|
6
|
+
include Config
|
7
|
+
|
8
|
+
attr_reader :backend
|
9
|
+
|
10
|
+
class << self
|
11
|
+
# Define a block used to build this adapter's backend. The block will
|
12
|
+
# receive as keyword arguments any options passed to the adapter during
|
13
|
+
# initialization that are not config settings.
|
14
|
+
#
|
15
|
+
# If the adapter is initialized with a `:backend` option, this will be used
|
16
|
+
# instead, and the block won't be called.
|
17
|
+
#
|
18
|
+
# @param [Boolean] required
|
19
|
+
# @yield [**options] options passed to the adapter's initialize method
|
20
|
+
# @yieldreturn [Object] The backend to use
|
21
|
+
def backend(required: true, &block)
|
22
|
+
raise "backend block already set" if class_variables(false).include?(:@@backend_block)
|
23
|
+
class_variable_set(:@@backend_block, block)
|
24
|
+
class_variable_set(:@@backend_required, true) if required
|
25
|
+
end
|
26
|
+
|
27
|
+
def backend_block
|
28
|
+
class_variable_get(:@@backend_block) if class_variable_defined?(:@@backend_block)
|
29
|
+
end
|
30
|
+
|
31
|
+
def backend_required?
|
32
|
+
class_variable_defined?(:@@backend_required)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# @param [Hash] options
|
37
|
+
def initialize(options = {})
|
38
|
+
set_backend(**configure(**options))
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def set_backend(backend: nil, **options)
|
44
|
+
@backend = backend ||
|
45
|
+
if backend_block = self.class.backend_block
|
46
|
+
instance_exec(**options, &backend_block)
|
47
|
+
end
|
48
|
+
|
49
|
+
raise ArgumentError, 'backend needs to be set - refer to adapter documentation' if !@backend && self.class.backend_required?
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|