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
@@ -4,30 +4,50 @@ require 'rack/mock'
|
|
4
4
|
require 'thread'
|
5
5
|
|
6
6
|
describe Rack::Session::Moneta do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
use_timecop
|
8
|
+
|
9
|
+
let(:session_key) { Rack::Session::Moneta::DEFAULT_OPTIONS[:key] }
|
10
|
+
let(:session_match) { /#{session_key}=([0-9a-fA-F]+);/ }
|
11
|
+
|
12
|
+
let :incrementor_proc do
|
13
|
+
lambda do |env|
|
14
|
+
env["rack.session"]["counter"] ||= 0
|
15
|
+
env["rack.session"]["counter"] += 1
|
16
|
+
Rack::Response.new(env["rack.session"].inspect).to_a
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
let :drop_session do
|
21
|
+
Rack::Lint.new(proc do |env|
|
22
|
+
env['rack.session.options'][:drop] = true
|
23
|
+
incrementor_proc.call(env)
|
24
|
+
end)
|
25
|
+
end
|
26
|
+
|
27
|
+
let :renew_session do
|
28
|
+
Rack::Lint.new(proc do |env|
|
29
|
+
env['rack.session.options'][:renew] = true
|
30
|
+
incrementor_proc.call(env)
|
31
|
+
end)
|
32
|
+
end
|
33
|
+
|
34
|
+
let :defer_session do
|
35
|
+
Rack::Lint.new(proc do |env|
|
36
|
+
env['rack.session.options'][:defer] = true
|
37
|
+
incrementor_proc.call(env)
|
38
|
+
end)
|
39
|
+
end
|
40
|
+
|
41
|
+
let :skip_session do
|
42
|
+
Rack::Lint.new(proc do |env|
|
43
|
+
env['rack.session.options'][:skip] = true
|
44
|
+
incrementor_proc.call(env)
|
45
|
+
end)
|
46
|
+
end
|
47
|
+
|
48
|
+
let :incrementor do
|
49
|
+
Rack::Lint.new(incrementor_proc)
|
13
50
|
end
|
14
|
-
drop_session = Rack::Lint.new(proc do |env|
|
15
|
-
env['rack.session.options'][:drop] = true
|
16
|
-
incrementor.call(env)
|
17
|
-
end)
|
18
|
-
renew_session = Rack::Lint.new(proc do |env|
|
19
|
-
env['rack.session.options'][:renew] = true
|
20
|
-
incrementor.call(env)
|
21
|
-
end)
|
22
|
-
defer_session = Rack::Lint.new(proc do |env|
|
23
|
-
env['rack.session.options'][:defer] = true
|
24
|
-
incrementor.call(env)
|
25
|
-
end)
|
26
|
-
skip_session = Rack::Lint.new(proc do |env|
|
27
|
-
env['rack.session.options'][:skip] = true
|
28
|
-
incrementor.call(env)
|
29
|
-
end)
|
30
|
-
incrementor = Rack::Lint.new(incrementor)
|
31
51
|
|
32
52
|
it 'supports different constructors' do
|
33
53
|
Rack::Session::Moneta.new(incrementor, :store => :Memory)
|
@@ -96,8 +116,7 @@ describe Rack::Session::Moneta do
|
|
96
116
|
res = Rack::MockRequest.new(pool).get('/', "HTTP_COOKIE" => cookie)
|
97
117
|
res["Set-Cookie"].should == cookie
|
98
118
|
res.body.should include '"counter"=>2'
|
99
|
-
|
100
|
-
sleep 4
|
119
|
+
advance 4
|
101
120
|
res = Rack::MockRequest.new(pool).get('/', "HTTP_COOKIE" => cookie)
|
102
121
|
res["Set-Cookie"].should_not == cookie
|
103
122
|
res.body.should include '"counter"=>1'
|
data/spec/restserver.rb
CHANGED
@@ -1,18 +1,7 @@
|
|
1
1
|
require 'faraday'
|
2
2
|
require 'rack'
|
3
3
|
require 'rack/moneta_rest'
|
4
|
-
|
5
|
-
MONETA_RESTSERVER_LOGGER =
|
6
|
-
if defined?(JRUBY_VERSION)
|
7
|
-
require 'rjack-logback'
|
8
|
-
RJack::Logback.config_console( :level => :off )
|
9
|
-
require 'fishwife'
|
10
|
-
nil
|
11
|
-
else
|
12
|
-
require 'webrick'
|
13
|
-
# Keep webrick quiet
|
14
|
-
WEBrick::Log.new($stderr, WEBrick::BasicLog::ERROR)
|
15
|
-
end
|
4
|
+
require 'webrick'
|
16
5
|
|
17
6
|
class MonetaRestServerShutdown < StandardError; end
|
18
7
|
|
@@ -25,10 +14,10 @@ def start_restserver(port)
|
|
25
14
|
end
|
26
15
|
end,
|
27
16
|
:environment => 'none',
|
28
|
-
:server =>
|
17
|
+
:server => :webrick,
|
29
18
|
:Port => port,
|
30
19
|
:AccessLog => [],
|
31
|
-
:Logger =>
|
20
|
+
:Logger => WEBrick::Log.new($stderr, WEBrick::BasicLog::ERROR)
|
32
21
|
)
|
33
22
|
|
34
23
|
Thread.start { server.start }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moneta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Mendler
|
@@ -11,8 +11,22 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2022-04-06 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: multi_json
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - "~>"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.15.0
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.15.0
|
16
30
|
- !ruby/object:Gem::Dependency
|
17
31
|
name: parallel_tests
|
18
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -125,6 +139,7 @@ files:
|
|
125
139
|
- lib/action_dispatch/middleware/session/moneta_store.rb
|
126
140
|
- lib/active_support/cache/moneta_store.rb
|
127
141
|
- lib/moneta.rb
|
142
|
+
- lib/moneta/adapter.rb
|
128
143
|
- lib/moneta/adapters/activerecord.rb
|
129
144
|
- lib/moneta/adapters/activesupportcache.rb
|
130
145
|
- lib/moneta/adapters/cassandra.rb
|
@@ -166,6 +181,7 @@ files:
|
|
166
181
|
- lib/moneta/adapters/yaml.rb
|
167
182
|
- lib/moneta/builder.rb
|
168
183
|
- lib/moneta/cache.rb
|
184
|
+
- lib/moneta/config.rb
|
169
185
|
- lib/moneta/create_support.rb
|
170
186
|
- lib/moneta/dbm_adapter.rb
|
171
187
|
- lib/moneta/defaults.rb
|
@@ -354,6 +370,7 @@ files:
|
|
354
370
|
- spec/moneta/adapters/yaml/standard_yaml_spec.rb
|
355
371
|
- spec/moneta/adapters/yaml/standard_yaml_with_expires_spec.rb
|
356
372
|
- spec/moneta/builder_spec.rb
|
373
|
+
- spec/moneta/config_spec.rb
|
357
374
|
- spec/moneta/mutex_spec.rb
|
358
375
|
- spec/moneta/proxies/cache/cache_file_memory_spec.rb
|
359
376
|
- spec/moneta/proxies/cache/cache_memory_null_spec.rb
|
@@ -429,9 +446,9 @@ licenses:
|
|
429
446
|
- MIT
|
430
447
|
metadata:
|
431
448
|
bug_tracker_uri: https://github.com/moneta-rb/moneta/issues
|
432
|
-
changelog_uri: https://github.com/moneta-rb/moneta/blob/v1.
|
433
|
-
documentation_uri: https://www.rubydoc.info/gems/moneta/1.
|
434
|
-
source_code_uri: https://github.com/moneta-rb/moneta/tree/v1.
|
449
|
+
changelog_uri: https://github.com/moneta-rb/moneta/blob/v1.5.0/CHANGES
|
450
|
+
documentation_uri: https://www.rubydoc.info/gems/moneta/1.5.0
|
451
|
+
source_code_uri: https://github.com/moneta-rb/moneta/tree/v1.5.0
|
435
452
|
post_install_message:
|
436
453
|
rdoc_options: []
|
437
454
|
require_paths:
|
@@ -447,7 +464,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
447
464
|
- !ruby/object:Gem::Version
|
448
465
|
version: '0'
|
449
466
|
requirements: []
|
450
|
-
rubygems_version: 3.
|
467
|
+
rubygems_version: 3.3.8
|
451
468
|
signing_key:
|
452
469
|
specification_version: 4
|
453
470
|
summary: A unified interface to key/value stores, including Redis, Memcached, TokyoCabinet,
|
@@ -596,6 +613,7 @@ test_files:
|
|
596
613
|
- spec/moneta/adapters/yaml/standard_yaml_spec.rb
|
597
614
|
- spec/moneta/adapters/yaml/standard_yaml_with_expires_spec.rb
|
598
615
|
- spec/moneta/builder_spec.rb
|
616
|
+
- spec/moneta/config_spec.rb
|
599
617
|
- spec/moneta/mutex_spec.rb
|
600
618
|
- spec/moneta/proxies/cache/cache_file_memory_spec.rb
|
601
619
|
- spec/moneta/proxies/cache/cache_memory_null_spec.rb
|