moneta 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +26 -8
- data/CHANGES +6 -0
- data/CONTRIBUTORS +2 -1
- data/Gemfile +7 -5
- data/README.md +2 -6
- data/feature_matrix.yaml +0 -10
- data/lib/moneta.rb +9 -9
- data/lib/moneta/adapters/mongo.rb +256 -7
- data/lib/moneta/adapters/redis.rb +5 -1
- data/lib/moneta/adapters/sequel.rb +45 -464
- data/lib/moneta/adapters/sequel/mysql.rb +66 -0
- data/lib/moneta/adapters/sequel/postgres.rb +80 -0
- data/lib/moneta/adapters/sequel/postgres_hstore.rb +240 -0
- data/lib/moneta/adapters/sequel/sqlite.rb +57 -0
- data/lib/moneta/adapters/sqlite.rb +7 -7
- data/lib/moneta/create_support.rb +21 -0
- data/lib/moneta/dbm_adapter.rb +31 -0
- data/lib/moneta/{mixins.rb → defaults.rb} +1 -302
- data/lib/moneta/each_key_support.rb +27 -0
- data/lib/moneta/expires_support.rb +60 -0
- data/lib/moneta/hash_adapter.rb +68 -0
- data/lib/moneta/increment_support.rb +16 -0
- data/lib/moneta/nil_values.rb +35 -0
- data/lib/moneta/option_support.rb +51 -0
- data/lib/moneta/transformer/helper/bson.rb +5 -15
- data/lib/moneta/version.rb +1 -1
- data/lib/rack/cache/moneta.rb +14 -15
- data/moneta.gemspec +7 -9
- data/script/benchmarks +1 -2
- data/script/contributors +11 -6
- data/spec/active_support/cache_moneta_store_spec.rb +27 -29
- data/spec/features/concurrent_increment.rb +2 -3
- data/spec/features/create_expires.rb +15 -15
- data/spec/features/default_expires.rb +11 -12
- data/spec/features/expires.rb +215 -210
- data/spec/helper.rb +16 -33
- data/spec/moneta/adapters/mongo/adapter_mongo_spec.rb +16 -1
- data/spec/moneta/adapters/mongo/adapter_mongo_with_default_expires_spec.rb +1 -1
- data/spec/moneta/adapters/mongo/standard_mongo_spec.rb +1 -1
- data/spec/moneta/adapters/sequel/adapter_sequel_spec.rb +7 -34
- data/spec/moneta/adapters/sequel/helper.rb +37 -0
- data/spec/moneta/adapters/sequel/standard_sequel_spec.rb +4 -10
- data/spec/moneta/adapters/sequel/standard_sequel_with_expires_spec.rb +7 -8
- data/spec/moneta/proxies/shared/shared_unix_spec.rb +10 -0
- data/spec/restserver.rb +15 -0
- metadata +39 -58
- data/lib/moneta/adapters/mongo/base.rb +0 -103
- data/lib/moneta/adapters/mongo/moped.rb +0 -166
- data/lib/moneta/adapters/mongo/official.rb +0 -156
- data/spec/moneta/adapters/mongo/adapter_mongo_moped_spec.rb +0 -26
- data/spec/moneta/adapters/mongo/adapter_mongo_moped_with_default_expires_spec.rb +0 -14
- data/spec/moneta/adapters/mongo/adapter_mongo_official_spec.rb +0 -27
- data/spec/moneta/adapters/mongo/adapter_mongo_official_with_default_expires_spec.rb +0 -14
- data/spec/moneta/adapters/mongo/standard_mongo_moped_spec.rb +0 -7
- data/spec/moneta/adapters/mongo/standard_mongo_official_spec.rb +0 -7
- data/spec/quality_spec.rb +0 -51
@@ -1,14 +0,0 @@
|
|
1
|
-
describe 'adapter_mongo_moped_with_default_expires', isolate: true, adapter: :Mongo do
|
2
|
-
let(:t_res) { 0.125 }
|
3
|
-
let(:min_ttl) { t_res }
|
4
|
-
|
5
|
-
moneta_build do
|
6
|
-
Moneta::Adapters::MongoMoped.new(mongo_config(
|
7
|
-
db: File.basename(__FILE__, '.rb'),
|
8
|
-
collection: 'moped_with_default_expires',
|
9
|
-
expires: min_ttl
|
10
|
-
))
|
11
|
-
end
|
12
|
-
|
13
|
-
moneta_specs ADAPTER_SPECS.with_each_key.with_expires.with_default_expires.simplevalues_only
|
14
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
describe 'adapter_mongo_official', adapter: :Mongo do
|
2
|
-
let(:t_res) { 0.125 }
|
3
|
-
let(:min_ttl) { t_res }
|
4
|
-
|
5
|
-
moneta_build do
|
6
|
-
Moneta::Adapters::MongoOfficial.new(mongo_config(
|
7
|
-
db: File.basename(__FILE__, '.rb'),
|
8
|
-
collection: 'official'
|
9
|
-
))
|
10
|
-
end
|
11
|
-
|
12
|
-
moneta_specs ADAPTER_SPECS.with_each_key.with_native_expires.simplevalues_only
|
13
|
-
|
14
|
-
it 'automatically deletes expired document' do
|
15
|
-
store.store('key', 'val', expires: 5)
|
16
|
-
|
17
|
-
i = 0
|
18
|
-
query = store.instance_variable_get(:@collection).find(_id: ::BSON::Binary.new('key'))
|
19
|
-
while i < 70 && query.first
|
20
|
-
i += 1
|
21
|
-
sleep 1 # Mongo needs up to 60 seconds
|
22
|
-
end
|
23
|
-
|
24
|
-
i.should be > 0 # Indicates that it took at least one sleep to expire
|
25
|
-
query.count.should == 0
|
26
|
-
end
|
27
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
describe 'adapter_mongo_official_with_default_expires', isolate: true, adapter: :Mongo do
|
2
|
-
let(:t_res) { 0.125 }
|
3
|
-
let(:min_ttl) { t_res }
|
4
|
-
|
5
|
-
moneta_build do
|
6
|
-
Moneta::Adapters::MongoOfficial.new(mongo_config(
|
7
|
-
db: File.basename(__FILE__, '.rb'),
|
8
|
-
collection: 'official_with_default_expires',
|
9
|
-
expires: min_ttl
|
10
|
-
))
|
11
|
-
end
|
12
|
-
|
13
|
-
moneta_specs ADAPTER_SPECS.with_each_key.with_expires.with_default_expires.simplevalues_only
|
14
|
-
end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
describe 'standard_mongo_moped', adapter: :Mongo do
|
2
|
-
let(:t_res) { 0.125 }
|
3
|
-
let(:min_ttl) { t_res }
|
4
|
-
|
5
|
-
moneta_store :MongoMoped, MongoHelper::mongo_config(db: File.basename(__FILE__, '.rb'), collection: 'moped')
|
6
|
-
moneta_specs STANDARD_SPECS.with_native_expires.with_each_key
|
7
|
-
end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
describe 'standard_mongo_official', adapter: :Mongo do
|
2
|
-
let(:t_res) { 0.125 }
|
3
|
-
let(:min_ttl) { t_res }
|
4
|
-
|
5
|
-
moneta_store :MongoOfficial, MongoHelper::mongo_config(db: File.basename(__FILE__, '.rb'), collection: 'official')
|
6
|
-
moneta_specs STANDARD_SPECS.with_native_expires.with_each_key
|
7
|
-
end
|
data/spec/quality_spec.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
if defined?(Encoding) && Encoding.default_external != "UTF-8"
|
2
|
-
Encoding.default_external = "UTF-8"
|
3
|
-
end
|
4
|
-
|
5
|
-
describe "The library itself", skip: true do
|
6
|
-
def check_for_tab_characters(filename)
|
7
|
-
failing_lines = []
|
8
|
-
File.readlines(filename).each_with_index do |line,number|
|
9
|
-
failing_lines << number + 1 if line =~ /\t/
|
10
|
-
end
|
11
|
-
|
12
|
-
unless failing_lines.empty?
|
13
|
-
"#{filename} has tab characters on lines #{failing_lines.join(', ')}"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def check_for_extra_spaces(filename)
|
18
|
-
failing_lines = []
|
19
|
-
File.readlines(filename).each_with_index do |line,number|
|
20
|
-
next if line =~ /^\s+#.*\s+\n$/
|
21
|
-
failing_lines << number + 1 if line =~ /\s+\n$/
|
22
|
-
end
|
23
|
-
|
24
|
-
unless failing_lines.empty?
|
25
|
-
"#{filename} has spaces on the EOL on lines #{failing_lines.join(', ')}"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
RSpec::Matchers.define :be_well_formed do
|
30
|
-
failure_message_for_should do |actual|
|
31
|
-
actual.join("\n")
|
32
|
-
end
|
33
|
-
|
34
|
-
match do |actual|
|
35
|
-
actual.empty?
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
it "has no malformed whitespace" do
|
40
|
-
exempt = /\.gitmodules|\.marshal|fixtures|vendor|ssl_certs|kill|LICENSE/
|
41
|
-
error_messages = []
|
42
|
-
Dir.chdir(File.expand_path("../..", __FILE__)) do
|
43
|
-
`git ls-files`.split("\n").each do |filename|
|
44
|
-
next if filename =~ exempt
|
45
|
-
error_messages << check_for_tab_characters(filename)
|
46
|
-
error_messages << check_for_extra_spaces(filename)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
expect(error_messages.compact).to be_well_formed
|
50
|
-
end
|
51
|
-
end
|