juno 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -9,12 +9,13 @@ fork was that Moneta was unmaintained for a long time.
9
9
 
10
10
  Juno is very feature rich:
11
11
 
12
- * Supports for a lot of backends (See below)
12
+ * Supports a lot of backends (See below)
13
13
  * Supports proxies (Similar to [Rack middlewares](http://rack.github.com/))
14
14
  * Custom serialization via `Juno::Transformer` proxy (Marshal/JSON/YAML and many more)
15
15
  * Custom key transformation via `Juno::Transformer` proxy
16
16
  * Value compression via `Juno::Transformer` proxy (Zlib, Snappy, QuickLZ, LZO)
17
17
  * Expiration for all stores (Added via proxy if not supported natively)
18
+ * Integration with Rack as session store and Rack-Cache
18
19
 
19
20
  Supported backends
20
21
  ------------------
@@ -16,7 +16,6 @@ module Juno
16
16
  :bencode => { :load => '::BEncode.load(value)', :dump => '::BEncode.dump(value)', :require => 'bencode' },
17
17
  :bert => { :load => '::BERT.decode(value)', :dump => '::BERT.encode(value)', :require => 'bert' },
18
18
  :bson => { :load => "::BSON.deserialize(value)['v']", :dump => "::BSON.serialize('v'=>value)", :require => 'bson' },
19
- :compress => { :load => '::Zlib::Inflate.inflate(value)', :dump => '::Zlib::Deflate.deflate(value)', :require => 'zlib' },
20
19
  :json => { :load => '::MultiJson.load(value).first', :dump => '::MultiJson.dump([value])', :require => 'multi_json' },
21
20
  :lzma => { :load => '::LZMA.decompress(value)', :dump => '::LZMA.compress(value)', :require => 'lzma' },
22
21
  :lzo => { :load => '::LZO.decompress(value)', :dump => '::LZO.compress(value)', :require => 'lzoruby' },
@@ -28,13 +27,14 @@ module Juno
28
27
  :tnet => { :load => '::TNetstring.parse(value).first', :dump => '::TNetstring.dump(value)', :require => 'tnetstring' },
29
28
  :uuencode => { :load => "value.unpack('u').first", :dump => "[value].pack('u').strip" },
30
29
  :yaml => { :load => '::YAML.load(value)', :dump => '::YAML.dump(value)', :require => 'yaml' },
30
+ :zlib => { :load => '::Zlib::Inflate.inflate(value)', :dump => '::Zlib::Deflate.deflate(value)', :require => 'zlib' },
31
31
  }
32
32
 
33
33
  # Available key transformers (Only encoding, one direction)
34
34
  KEY_TRANSFORMER = {
35
35
  :base64 => { :transform => "[key].pack('m').strip" },
36
- :bencode => { :transform => '::BEncode.dump(key)', :require => 'bencode' },
37
- :bert => { :transform => '::BERT.encode(key)', :require => 'bert' },
36
+ :bencode => { :transform => '(tmp = key; String === tmp ? tmp : ::BEncode.dump(tmp))', :require => 'bencode' },
37
+ :bert => { :transform => '(tmp = key; String === tmp ? tmp : ::BERT.encode(tmp))', :require => 'bert' },
38
38
  :bson => { :transform => "(tmp = key; String === tmp ? tmp : ::BSON.serialize('k'=>tmp).to_s)", :require => 'bson' },
39
39
  :escape => { :transform => "key.gsub(/[^a-zA-Z0-9_-]+/) { '%%' + $&.unpack('H2' * $&.bytesize).join('%%').upcase }" },
40
40
  :json => { :transform => '(tmp = key; String === tmp ? tmp : ::MultiJson.dump(tmp))', :require => 'multi_json' },
@@ -42,15 +42,18 @@ module Juno
42
42
  :md5 => { :transform => '::Digest::MD5.hexdigest(key)', :require => 'digest/md5' },
43
43
  :msgpack => { :transform => '(tmp = key; String === tmp ? tmp : ::MessagePack.pack(tmp))', :require => 'msgpack' },
44
44
  :prefix => { :transform => '@prefix+key' },
45
+ :rmd160 => { :transform => '::Digest::RMD160.hexdigest(key)', :require => 'digest/rmd160' },
45
46
  :ox => { :transform => '(tmp = key; String === tmp ? tmp : ::Ox.dump(tmp))', :require => 'ox' },
47
+ :sha1 => { :transform => '::Digest::SHA1.hexdigest(key)', :require => 'digest/sha1' },
48
+ :sha256 => { :transform => '::Digest::SHA256.hexdigest(key)', :require => 'digest/sha2' },
49
+ :sha384 => { :transform => '::Digest::SHA384.hexdigest(key)', :require => 'digest/sha2' },
50
+ :sha512 => { :transform => '::Digest::SHA512.hexdigest(key)', :require => 'digest/sha2' },
46
51
  :spread => { :transform => '(tmp = key; ::File.join(tmp[0..1], tmp[2..-1]))' },
47
52
  :tnet => { :transform => '(tmp = key; String === tmp ? tmp : ::TNetstring.dump(tmp))', :require => 'tnetstring' },
48
53
  :uuencode => { :transform => "[key].pack('u').strip" },
49
54
  :yaml => { :transform => '(tmp = key; String === tmp ? tmp : ::YAML.dump(tmp))', :require => 'yaml' },
50
55
  }
51
56
 
52
- @classes = {}
53
-
54
57
  def initialize(adapter, options = {})
55
58
  super
56
59
  @prefix = options[:prefix]
@@ -72,9 +75,12 @@ module Juno
72
75
  keys = [options[:key]].flatten.compact
73
76
  values = [options[:value]].flatten.compact
74
77
  raise 'Option :key or :value is required' if keys.empty? && values.empty?
75
- klass = @classes["#{keys.join('-')}+#{values.join('-')}"] ||= compile(keys, values)
76
78
  raise 'Option :prefix is required' if keys.include?(:prefix) && !options[:prefix]
77
- klass.original_new(adapter, options)
79
+ name = ''
80
+ name << keys.map(&:to_s).map(&:capitalize).join << 'Key' unless keys.empty?
81
+ name << values.map(&:to_s).map(&:capitalize).join << 'Value' unless values.empty?
82
+ const_set(name, compile(keys, values)) unless const_defined?(name)
83
+ const_get(name).original_new(adapter, options)
78
84
  end
79
85
 
80
86
  private
data/lib/juno/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Juno
2
2
  # Juno version number
3
3
  # @api public
4
- VERSION = '0.2.6'
4
+ VERSION = '0.2.7'
5
5
  end
data/lib/juno.rb CHANGED
@@ -45,10 +45,15 @@ module Juno
45
45
  # @param [Hash] options
46
46
  #
47
47
  # Options:
48
- # * :expires - If options is true, ensure that store supports expiration by inserting
48
+ # * :expires - If true, ensure that store supports expiration by inserting
49
49
  # Juno::Expires if the underlying adapter doesn't support it natively
50
- # * :threadsafe - If options is true, ensure that the store is thread safe by inserting Juno::Lock
51
- # * :logger - If options is a true or Hash, add logger to chain (Hash is passed to logger as options)
50
+ # * :threadsafe - If true, ensure that the store is thread safe by inserting Juno::Lock
51
+ # * :logger - If true or Hash, add logger to chain (Hash is passed to logger as options)
52
+ # * :compress - If true, compress value with zlib, or specify custom compress, e.g. :quicklz
53
+ # * :serializer - Serializer used for key and value (default :marshal, disable with nil)
54
+ # * :key_serializer - Serializer used for key (default options[:serializer])
55
+ # * :value_serializer - Serializer used for key (default options[:serializer])
56
+ # * :prefix - Key prefix used for namespacing (default none)
52
57
  # * All other options passed to the adapter
53
58
  #
54
59
  # Supported adapters:
@@ -60,27 +65,34 @@ module Juno
60
65
  expires = options.delete(:expires)
61
66
  logger = options.delete(:logger)
62
67
  threadsafe = options.delete(:threadsafe)
63
- transformer = {:key => :marshal, :value => :marshal}
68
+ compress = options.delete(:compress)
69
+ serializer = options.delete(:serializer) || :marshal
70
+ key_serializer = options.delete(:key_serializer) || serializer
71
+ value_serializer = options.delete(:value_serializer) || serializer
72
+ transformer = { :key => [key_serializer], :value => [value_serializer], :prefix => options.delete(:prefix) }
73
+ transformer[:key] << :prefix if transformer[:prefix]
74
+ transformer[:value] << (Symbol === compress ? compress : :zlib) if compress
64
75
  raise 'Name must be Symbol' unless Symbol === name
65
76
  case name
66
77
  when :Sequel, :ActiveRecord, :Couch
67
78
  # Sequel accept only base64 keys and values
68
79
  # FIXME: Couch should work only with :marshal but this raises an error on 1.9
69
- transformer = {:key => [:marshal, :base64], :value => [:marshal, :base64]}
80
+ transformer[:key] << :base64
81
+ transformer[:value] << :base64
70
82
  when :Memcached, :MemcachedDalli, :MemcachedNative
71
83
  # Memcached accept only base64 keys, expires already supported
72
84
  expires = false
73
- transformer[:key] = [:marshal, :base64]
85
+ transformer[:key] << :base64
74
86
  when :PStore, :YAML, :DataMapper, :Null
75
87
  # For PStore, YAML and DataMapper only the key has to be a string
76
- transformer.delete(:value)
88
+ transformer.delete(:value) if transformer[:value] == [:marshal]
77
89
  when :HashFile
78
90
  # Use spreading hashes
79
- transformer[:key] = [:marshal, :md5, :spread]
91
+ transformer[:key] << :md5 << :spread
80
92
  name = :File
81
93
  when :File
82
94
  # Use escaping
83
- transformer[:key] = [:marshal, :escape]
95
+ transformer[:key] << :escape
84
96
  when :Cassandra, :Redis
85
97
  # Expires already supported
86
98
  expires = false
data/spec/generate.rb CHANGED
@@ -12,6 +12,42 @@ TESTS = {
12
12
  :options => ':expires => true',
13
13
  :specs => EXPIRES_SPECS,
14
14
  },
15
+ 'simple_memory_with_compress' => {
16
+ :store => :Memory,
17
+ :options => ':compress => true',
18
+ },
19
+ 'simple_memory_with_prefix' => {
20
+ :store => :Memory,
21
+ :options => ':prefix => "juno"',
22
+ },
23
+ 'simple_memory_with_json_serializer' => {
24
+ :store => :Memory,
25
+ :options => ':serializer => :json',
26
+ :key => %w(Hash String),
27
+ :value => %w(Hash String),
28
+ :specs => [:null, :store, :returndifferent],
29
+ },
30
+ 'simple_memory_with_json_key_serializer' => {
31
+ :store => :Memory,
32
+ :options => ':key_serializer => :json',
33
+ :key => %w(Hash String),
34
+ :specs => [:null, :store, :returndifferent],
35
+ },
36
+ 'simple_memory_with_json_md5_key_serializer' => {
37
+ :store => :Memory,
38
+ :options => ':key_serializer => [:json, :md5]',
39
+ :key => %w(Hash String),
40
+ :specs => [:null, :store, :returndifferent],
41
+ },
42
+ 'simple_memory_with_json_value_serializer' => {
43
+ :store => :Memory,
44
+ :options => ':value_serializer => :json',
45
+ :value => %w(Hash String),
46
+ },
47
+ 'simple_memory_with_quicklz_compress' => {
48
+ :store => :Memory,
49
+ :options => ':compress => :quicklz',
50
+ },
15
51
  'simple_lruhash' => {
16
52
  :store => :LRUHash,
17
53
  },
@@ -332,9 +368,9 @@ end},
332
368
  end},
333
369
  :specs => [:null, :store]
334
370
  },
335
- 'transformer_compress' => {
371
+ 'transformer_zlib' => {
336
372
  :build => %{Juno.build do
337
- use :Transformer, :value => :compress
373
+ use :Transformer, :value => :zlib
338
374
  adapter :Memory
339
375
  end},
340
376
  :value => %w(String),
@@ -472,6 +508,41 @@ end},
472
508
  :build => %{Juno.build do
473
509
  use :Transformer, :key => [:marshal, :md5], :value => :marshal
474
510
  adapter :Memory
511
+ end},
512
+ :specs => [:null, :store, :returndifferent, :marshallable_key]
513
+ },
514
+ 'transformer_marshal_sha1' => {
515
+ :build => %{Juno.build do
516
+ use :Transformer, :key => [:marshal, :sha1], :value => :marshal
517
+ adapter :Memory
518
+ end},
519
+ :specs => [:null, :store, :returndifferent, :marshallable_key]
520
+ },
521
+ 'transformer_marshal_sha256' => {
522
+ :build => %{Juno.build do
523
+ use :Transformer, :key => [:marshal, :sha256], :value => :marshal
524
+ adapter :Memory
525
+ end},
526
+ :specs => [:null, :store, :returndifferent, :marshallable_key]
527
+ },
528
+ 'transformer_marshal_sha384' => {
529
+ :build => %{Juno.build do
530
+ use :Transformer, :key => [:marshal, :sha384], :value => :marshal
531
+ adapter :Memory
532
+ end},
533
+ :specs => [:null, :store, :returndifferent, :marshallable_key]
534
+ },
535
+ 'transformer_marshal_sha512' => {
536
+ :build => %{Juno.build do
537
+ use :Transformer, :key => [:marshal, :sha512], :value => :marshal
538
+ adapter :Memory
539
+ end},
540
+ :specs => [:null, :store, :returndifferent, :marshallable_key]
541
+ },
542
+ 'transformer_marshal_rmd160' => {
543
+ :build => %{Juno.build do
544
+ use :Transformer, :key => [:marshal, :rmd160], :value => :marshal
545
+ adapter :Memory
475
546
  end},
476
547
  :specs => [:null, :store, :returndifferent, :marshallable_key]
477
548
  },
@@ -0,0 +1,38 @@
1
+ # Generated by generate.rb
2
+ require 'helper'
3
+
4
+ describe_juno "simple_memory_with_compress" do
5
+ def new_store
6
+ Juno.new(:Memory, :compress => true, :logger => {:out => File.open(File.join(make_tempdir, 'simple_memory_with_compress.log'), 'a')})
7
+ end
8
+
9
+ include_context 'setup_store'
10
+ it_should_behave_like 'null_objectkey_objectvalue'
11
+ it_should_behave_like 'null_objectkey_stringvalue'
12
+ it_should_behave_like 'null_objectkey_hashvalue'
13
+ it_should_behave_like 'null_stringkey_objectvalue'
14
+ it_should_behave_like 'null_stringkey_stringvalue'
15
+ it_should_behave_like 'null_stringkey_hashvalue'
16
+ it_should_behave_like 'null_hashkey_objectvalue'
17
+ it_should_behave_like 'null_hashkey_stringvalue'
18
+ it_should_behave_like 'null_hashkey_hashvalue'
19
+ it_should_behave_like 'store_objectkey_objectvalue'
20
+ it_should_behave_like 'store_objectkey_stringvalue'
21
+ it_should_behave_like 'store_objectkey_hashvalue'
22
+ it_should_behave_like 'store_stringkey_objectvalue'
23
+ it_should_behave_like 'store_stringkey_stringvalue'
24
+ it_should_behave_like 'store_stringkey_hashvalue'
25
+ it_should_behave_like 'store_hashkey_objectvalue'
26
+ it_should_behave_like 'store_hashkey_stringvalue'
27
+ it_should_behave_like 'store_hashkey_hashvalue'
28
+ it_should_behave_like 'returndifferent_objectkey_objectvalue'
29
+ it_should_behave_like 'returndifferent_objectkey_stringvalue'
30
+ it_should_behave_like 'returndifferent_objectkey_hashvalue'
31
+ it_should_behave_like 'returndifferent_stringkey_objectvalue'
32
+ it_should_behave_like 'returndifferent_stringkey_stringvalue'
33
+ it_should_behave_like 'returndifferent_stringkey_hashvalue'
34
+ it_should_behave_like 'returndifferent_hashkey_objectvalue'
35
+ it_should_behave_like 'returndifferent_hashkey_stringvalue'
36
+ it_should_behave_like 'returndifferent_hashkey_hashvalue'
37
+ it_should_behave_like 'marshallable_key'
38
+ end
@@ -0,0 +1,28 @@
1
+ # Generated by generate.rb
2
+ require 'helper'
3
+
4
+ describe_juno "simple_memory_with_json_key_serializer" do
5
+ def new_store
6
+ Juno.new(:Memory, :key_serializer => :json, :logger => {:out => File.open(File.join(make_tempdir, 'simple_memory_with_json_key_serializer.log'), 'a')})
7
+ end
8
+
9
+ include_context 'setup_store'
10
+ it_should_behave_like 'null_hashkey_objectvalue'
11
+ it_should_behave_like 'null_hashkey_stringvalue'
12
+ it_should_behave_like 'null_hashkey_hashvalue'
13
+ it_should_behave_like 'null_stringkey_objectvalue'
14
+ it_should_behave_like 'null_stringkey_stringvalue'
15
+ it_should_behave_like 'null_stringkey_hashvalue'
16
+ it_should_behave_like 'store_hashkey_objectvalue'
17
+ it_should_behave_like 'store_hashkey_stringvalue'
18
+ it_should_behave_like 'store_hashkey_hashvalue'
19
+ it_should_behave_like 'store_stringkey_objectvalue'
20
+ it_should_behave_like 'store_stringkey_stringvalue'
21
+ it_should_behave_like 'store_stringkey_hashvalue'
22
+ it_should_behave_like 'returndifferent_hashkey_objectvalue'
23
+ it_should_behave_like 'returndifferent_hashkey_stringvalue'
24
+ it_should_behave_like 'returndifferent_hashkey_hashvalue'
25
+ it_should_behave_like 'returndifferent_stringkey_objectvalue'
26
+ it_should_behave_like 'returndifferent_stringkey_stringvalue'
27
+ it_should_behave_like 'returndifferent_stringkey_hashvalue'
28
+ end
@@ -0,0 +1,28 @@
1
+ # Generated by generate.rb
2
+ require 'helper'
3
+
4
+ describe_juno "simple_memory_with_json_md5_key_serializer" do
5
+ def new_store
6
+ Juno.new(:Memory, :key_serializer => [:json, :md5], :logger => {:out => File.open(File.join(make_tempdir, 'simple_memory_with_json_md5_key_serializer.log'), 'a')})
7
+ end
8
+
9
+ include_context 'setup_store'
10
+ it_should_behave_like 'null_hashkey_objectvalue'
11
+ it_should_behave_like 'null_hashkey_stringvalue'
12
+ it_should_behave_like 'null_hashkey_hashvalue'
13
+ it_should_behave_like 'null_stringkey_objectvalue'
14
+ it_should_behave_like 'null_stringkey_stringvalue'
15
+ it_should_behave_like 'null_stringkey_hashvalue'
16
+ it_should_behave_like 'store_hashkey_objectvalue'
17
+ it_should_behave_like 'store_hashkey_stringvalue'
18
+ it_should_behave_like 'store_hashkey_hashvalue'
19
+ it_should_behave_like 'store_stringkey_objectvalue'
20
+ it_should_behave_like 'store_stringkey_stringvalue'
21
+ it_should_behave_like 'store_stringkey_hashvalue'
22
+ it_should_behave_like 'returndifferent_hashkey_objectvalue'
23
+ it_should_behave_like 'returndifferent_hashkey_stringvalue'
24
+ it_should_behave_like 'returndifferent_hashkey_hashvalue'
25
+ it_should_behave_like 'returndifferent_stringkey_objectvalue'
26
+ it_should_behave_like 'returndifferent_stringkey_stringvalue'
27
+ it_should_behave_like 'returndifferent_stringkey_hashvalue'
28
+ end
@@ -0,0 +1,22 @@
1
+ # Generated by generate.rb
2
+ require 'helper'
3
+
4
+ describe_juno "simple_memory_with_json_serializer" do
5
+ def new_store
6
+ Juno.new(:Memory, :serializer => :json, :logger => {:out => File.open(File.join(make_tempdir, 'simple_memory_with_json_serializer.log'), 'a')})
7
+ end
8
+
9
+ include_context 'setup_store'
10
+ it_should_behave_like 'null_hashkey_hashvalue'
11
+ it_should_behave_like 'null_hashkey_stringvalue'
12
+ it_should_behave_like 'null_stringkey_hashvalue'
13
+ it_should_behave_like 'null_stringkey_stringvalue'
14
+ it_should_behave_like 'store_hashkey_hashvalue'
15
+ it_should_behave_like 'store_hashkey_stringvalue'
16
+ it_should_behave_like 'store_stringkey_hashvalue'
17
+ it_should_behave_like 'store_stringkey_stringvalue'
18
+ it_should_behave_like 'returndifferent_hashkey_hashvalue'
19
+ it_should_behave_like 'returndifferent_hashkey_stringvalue'
20
+ it_should_behave_like 'returndifferent_stringkey_hashvalue'
21
+ it_should_behave_like 'returndifferent_stringkey_stringvalue'
22
+ end
@@ -0,0 +1,29 @@
1
+ # Generated by generate.rb
2
+ require 'helper'
3
+
4
+ describe_juno "simple_memory_with_json_value_serializer" do
5
+ def new_store
6
+ Juno.new(:Memory, :value_serializer => :json, :logger => {:out => File.open(File.join(make_tempdir, 'simple_memory_with_json_value_serializer.log'), 'a')})
7
+ end
8
+
9
+ include_context 'setup_store'
10
+ it_should_behave_like 'null_objectkey_hashvalue'
11
+ it_should_behave_like 'null_objectkey_stringvalue'
12
+ it_should_behave_like 'null_stringkey_hashvalue'
13
+ it_should_behave_like 'null_stringkey_stringvalue'
14
+ it_should_behave_like 'null_hashkey_hashvalue'
15
+ it_should_behave_like 'null_hashkey_stringvalue'
16
+ it_should_behave_like 'store_objectkey_hashvalue'
17
+ it_should_behave_like 'store_objectkey_stringvalue'
18
+ it_should_behave_like 'store_stringkey_hashvalue'
19
+ it_should_behave_like 'store_stringkey_stringvalue'
20
+ it_should_behave_like 'store_hashkey_hashvalue'
21
+ it_should_behave_like 'store_hashkey_stringvalue'
22
+ it_should_behave_like 'returndifferent_objectkey_hashvalue'
23
+ it_should_behave_like 'returndifferent_objectkey_stringvalue'
24
+ it_should_behave_like 'returndifferent_stringkey_hashvalue'
25
+ it_should_behave_like 'returndifferent_stringkey_stringvalue'
26
+ it_should_behave_like 'returndifferent_hashkey_hashvalue'
27
+ it_should_behave_like 'returndifferent_hashkey_stringvalue'
28
+ it_should_behave_like 'marshallable_key'
29
+ end
@@ -0,0 +1,38 @@
1
+ # Generated by generate.rb
2
+ require 'helper'
3
+
4
+ describe_juno "simple_memory_with_prefix" do
5
+ def new_store
6
+ Juno.new(:Memory, :prefix => "juno", :logger => {:out => File.open(File.join(make_tempdir, 'simple_memory_with_prefix.log'), 'a')})
7
+ end
8
+
9
+ include_context 'setup_store'
10
+ it_should_behave_like 'null_objectkey_objectvalue'
11
+ it_should_behave_like 'null_objectkey_stringvalue'
12
+ it_should_behave_like 'null_objectkey_hashvalue'
13
+ it_should_behave_like 'null_stringkey_objectvalue'
14
+ it_should_behave_like 'null_stringkey_stringvalue'
15
+ it_should_behave_like 'null_stringkey_hashvalue'
16
+ it_should_behave_like 'null_hashkey_objectvalue'
17
+ it_should_behave_like 'null_hashkey_stringvalue'
18
+ it_should_behave_like 'null_hashkey_hashvalue'
19
+ it_should_behave_like 'store_objectkey_objectvalue'
20
+ it_should_behave_like 'store_objectkey_stringvalue'
21
+ it_should_behave_like 'store_objectkey_hashvalue'
22
+ it_should_behave_like 'store_stringkey_objectvalue'
23
+ it_should_behave_like 'store_stringkey_stringvalue'
24
+ it_should_behave_like 'store_stringkey_hashvalue'
25
+ it_should_behave_like 'store_hashkey_objectvalue'
26
+ it_should_behave_like 'store_hashkey_stringvalue'
27
+ it_should_behave_like 'store_hashkey_hashvalue'
28
+ it_should_behave_like 'returndifferent_objectkey_objectvalue'
29
+ it_should_behave_like 'returndifferent_objectkey_stringvalue'
30
+ it_should_behave_like 'returndifferent_objectkey_hashvalue'
31
+ it_should_behave_like 'returndifferent_stringkey_objectvalue'
32
+ it_should_behave_like 'returndifferent_stringkey_stringvalue'
33
+ it_should_behave_like 'returndifferent_stringkey_hashvalue'
34
+ it_should_behave_like 'returndifferent_hashkey_objectvalue'
35
+ it_should_behave_like 'returndifferent_hashkey_stringvalue'
36
+ it_should_behave_like 'returndifferent_hashkey_hashvalue'
37
+ it_should_behave_like 'marshallable_key'
38
+ end
@@ -0,0 +1,38 @@
1
+ # Generated by generate.rb
2
+ require 'helper'
3
+
4
+ describe_juno "simple_memory_with_quicklz_compress" do
5
+ def new_store
6
+ Juno.new(:Memory, :compress => :quicklz, :logger => {:out => File.open(File.join(make_tempdir, 'simple_memory_with_quicklz_compress.log'), 'a')})
7
+ end
8
+
9
+ include_context 'setup_store'
10
+ it_should_behave_like 'null_objectkey_objectvalue'
11
+ it_should_behave_like 'null_objectkey_stringvalue'
12
+ it_should_behave_like 'null_objectkey_hashvalue'
13
+ it_should_behave_like 'null_stringkey_objectvalue'
14
+ it_should_behave_like 'null_stringkey_stringvalue'
15
+ it_should_behave_like 'null_stringkey_hashvalue'
16
+ it_should_behave_like 'null_hashkey_objectvalue'
17
+ it_should_behave_like 'null_hashkey_stringvalue'
18
+ it_should_behave_like 'null_hashkey_hashvalue'
19
+ it_should_behave_like 'store_objectkey_objectvalue'
20
+ it_should_behave_like 'store_objectkey_stringvalue'
21
+ it_should_behave_like 'store_objectkey_hashvalue'
22
+ it_should_behave_like 'store_stringkey_objectvalue'
23
+ it_should_behave_like 'store_stringkey_stringvalue'
24
+ it_should_behave_like 'store_stringkey_hashvalue'
25
+ it_should_behave_like 'store_hashkey_objectvalue'
26
+ it_should_behave_like 'store_hashkey_stringvalue'
27
+ it_should_behave_like 'store_hashkey_hashvalue'
28
+ it_should_behave_like 'returndifferent_objectkey_objectvalue'
29
+ it_should_behave_like 'returndifferent_objectkey_stringvalue'
30
+ it_should_behave_like 'returndifferent_objectkey_hashvalue'
31
+ it_should_behave_like 'returndifferent_stringkey_objectvalue'
32
+ it_should_behave_like 'returndifferent_stringkey_stringvalue'
33
+ it_should_behave_like 'returndifferent_stringkey_hashvalue'
34
+ it_should_behave_like 'returndifferent_hashkey_objectvalue'
35
+ it_should_behave_like 'returndifferent_hashkey_stringvalue'
36
+ it_should_behave_like 'returndifferent_hashkey_hashvalue'
37
+ it_should_behave_like 'marshallable_key'
38
+ end
@@ -0,0 +1,41 @@
1
+ # Generated by generate.rb
2
+ require 'helper'
3
+
4
+ describe_juno "transformer_marshal_rmd160" do
5
+ def new_store
6
+ Juno.build do
7
+ use :Transformer, :key => [:marshal, :rmd160], :value => :marshal
8
+ adapter :Memory
9
+ end
10
+ end
11
+
12
+ include_context 'setup_store'
13
+ it_should_behave_like 'null_objectkey_objectvalue'
14
+ it_should_behave_like 'null_objectkey_stringvalue'
15
+ it_should_behave_like 'null_objectkey_hashvalue'
16
+ it_should_behave_like 'null_stringkey_objectvalue'
17
+ it_should_behave_like 'null_stringkey_stringvalue'
18
+ it_should_behave_like 'null_stringkey_hashvalue'
19
+ it_should_behave_like 'null_hashkey_objectvalue'
20
+ it_should_behave_like 'null_hashkey_stringvalue'
21
+ it_should_behave_like 'null_hashkey_hashvalue'
22
+ it_should_behave_like 'store_objectkey_objectvalue'
23
+ it_should_behave_like 'store_objectkey_stringvalue'
24
+ it_should_behave_like 'store_objectkey_hashvalue'
25
+ it_should_behave_like 'store_stringkey_objectvalue'
26
+ it_should_behave_like 'store_stringkey_stringvalue'
27
+ it_should_behave_like 'store_stringkey_hashvalue'
28
+ it_should_behave_like 'store_hashkey_objectvalue'
29
+ it_should_behave_like 'store_hashkey_stringvalue'
30
+ it_should_behave_like 'store_hashkey_hashvalue'
31
+ it_should_behave_like 'returndifferent_objectkey_objectvalue'
32
+ it_should_behave_like 'returndifferent_objectkey_stringvalue'
33
+ it_should_behave_like 'returndifferent_objectkey_hashvalue'
34
+ it_should_behave_like 'returndifferent_stringkey_objectvalue'
35
+ it_should_behave_like 'returndifferent_stringkey_stringvalue'
36
+ it_should_behave_like 'returndifferent_stringkey_hashvalue'
37
+ it_should_behave_like 'returndifferent_hashkey_objectvalue'
38
+ it_should_behave_like 'returndifferent_hashkey_stringvalue'
39
+ it_should_behave_like 'returndifferent_hashkey_hashvalue'
40
+ it_should_behave_like 'marshallable_key'
41
+ end
@@ -0,0 +1,41 @@
1
+ # Generated by generate.rb
2
+ require 'helper'
3
+
4
+ describe_juno "transformer_marshal_sha1" do
5
+ def new_store
6
+ Juno.build do
7
+ use :Transformer, :key => [:marshal, :sha1], :value => :marshal
8
+ adapter :Memory
9
+ end
10
+ end
11
+
12
+ include_context 'setup_store'
13
+ it_should_behave_like 'null_objectkey_objectvalue'
14
+ it_should_behave_like 'null_objectkey_stringvalue'
15
+ it_should_behave_like 'null_objectkey_hashvalue'
16
+ it_should_behave_like 'null_stringkey_objectvalue'
17
+ it_should_behave_like 'null_stringkey_stringvalue'
18
+ it_should_behave_like 'null_stringkey_hashvalue'
19
+ it_should_behave_like 'null_hashkey_objectvalue'
20
+ it_should_behave_like 'null_hashkey_stringvalue'
21
+ it_should_behave_like 'null_hashkey_hashvalue'
22
+ it_should_behave_like 'store_objectkey_objectvalue'
23
+ it_should_behave_like 'store_objectkey_stringvalue'
24
+ it_should_behave_like 'store_objectkey_hashvalue'
25
+ it_should_behave_like 'store_stringkey_objectvalue'
26
+ it_should_behave_like 'store_stringkey_stringvalue'
27
+ it_should_behave_like 'store_stringkey_hashvalue'
28
+ it_should_behave_like 'store_hashkey_objectvalue'
29
+ it_should_behave_like 'store_hashkey_stringvalue'
30
+ it_should_behave_like 'store_hashkey_hashvalue'
31
+ it_should_behave_like 'returndifferent_objectkey_objectvalue'
32
+ it_should_behave_like 'returndifferent_objectkey_stringvalue'
33
+ it_should_behave_like 'returndifferent_objectkey_hashvalue'
34
+ it_should_behave_like 'returndifferent_stringkey_objectvalue'
35
+ it_should_behave_like 'returndifferent_stringkey_stringvalue'
36
+ it_should_behave_like 'returndifferent_stringkey_hashvalue'
37
+ it_should_behave_like 'returndifferent_hashkey_objectvalue'
38
+ it_should_behave_like 'returndifferent_hashkey_stringvalue'
39
+ it_should_behave_like 'returndifferent_hashkey_hashvalue'
40
+ it_should_behave_like 'marshallable_key'
41
+ end
@@ -0,0 +1,41 @@
1
+ # Generated by generate.rb
2
+ require 'helper'
3
+
4
+ describe_juno "transformer_marshal_sha256" do
5
+ def new_store
6
+ Juno.build do
7
+ use :Transformer, :key => [:marshal, :sha256], :value => :marshal
8
+ adapter :Memory
9
+ end
10
+ end
11
+
12
+ include_context 'setup_store'
13
+ it_should_behave_like 'null_objectkey_objectvalue'
14
+ it_should_behave_like 'null_objectkey_stringvalue'
15
+ it_should_behave_like 'null_objectkey_hashvalue'
16
+ it_should_behave_like 'null_stringkey_objectvalue'
17
+ it_should_behave_like 'null_stringkey_stringvalue'
18
+ it_should_behave_like 'null_stringkey_hashvalue'
19
+ it_should_behave_like 'null_hashkey_objectvalue'
20
+ it_should_behave_like 'null_hashkey_stringvalue'
21
+ it_should_behave_like 'null_hashkey_hashvalue'
22
+ it_should_behave_like 'store_objectkey_objectvalue'
23
+ it_should_behave_like 'store_objectkey_stringvalue'
24
+ it_should_behave_like 'store_objectkey_hashvalue'
25
+ it_should_behave_like 'store_stringkey_objectvalue'
26
+ it_should_behave_like 'store_stringkey_stringvalue'
27
+ it_should_behave_like 'store_stringkey_hashvalue'
28
+ it_should_behave_like 'store_hashkey_objectvalue'
29
+ it_should_behave_like 'store_hashkey_stringvalue'
30
+ it_should_behave_like 'store_hashkey_hashvalue'
31
+ it_should_behave_like 'returndifferent_objectkey_objectvalue'
32
+ it_should_behave_like 'returndifferent_objectkey_stringvalue'
33
+ it_should_behave_like 'returndifferent_objectkey_hashvalue'
34
+ it_should_behave_like 'returndifferent_stringkey_objectvalue'
35
+ it_should_behave_like 'returndifferent_stringkey_stringvalue'
36
+ it_should_behave_like 'returndifferent_stringkey_hashvalue'
37
+ it_should_behave_like 'returndifferent_hashkey_objectvalue'
38
+ it_should_behave_like 'returndifferent_hashkey_stringvalue'
39
+ it_should_behave_like 'returndifferent_hashkey_hashvalue'
40
+ it_should_behave_like 'marshallable_key'
41
+ end
@@ -0,0 +1,41 @@
1
+ # Generated by generate.rb
2
+ require 'helper'
3
+
4
+ describe_juno "transformer_marshal_sha384" do
5
+ def new_store
6
+ Juno.build do
7
+ use :Transformer, :key => [:marshal, :sha384], :value => :marshal
8
+ adapter :Memory
9
+ end
10
+ end
11
+
12
+ include_context 'setup_store'
13
+ it_should_behave_like 'null_objectkey_objectvalue'
14
+ it_should_behave_like 'null_objectkey_stringvalue'
15
+ it_should_behave_like 'null_objectkey_hashvalue'
16
+ it_should_behave_like 'null_stringkey_objectvalue'
17
+ it_should_behave_like 'null_stringkey_stringvalue'
18
+ it_should_behave_like 'null_stringkey_hashvalue'
19
+ it_should_behave_like 'null_hashkey_objectvalue'
20
+ it_should_behave_like 'null_hashkey_stringvalue'
21
+ it_should_behave_like 'null_hashkey_hashvalue'
22
+ it_should_behave_like 'store_objectkey_objectvalue'
23
+ it_should_behave_like 'store_objectkey_stringvalue'
24
+ it_should_behave_like 'store_objectkey_hashvalue'
25
+ it_should_behave_like 'store_stringkey_objectvalue'
26
+ it_should_behave_like 'store_stringkey_stringvalue'
27
+ it_should_behave_like 'store_stringkey_hashvalue'
28
+ it_should_behave_like 'store_hashkey_objectvalue'
29
+ it_should_behave_like 'store_hashkey_stringvalue'
30
+ it_should_behave_like 'store_hashkey_hashvalue'
31
+ it_should_behave_like 'returndifferent_objectkey_objectvalue'
32
+ it_should_behave_like 'returndifferent_objectkey_stringvalue'
33
+ it_should_behave_like 'returndifferent_objectkey_hashvalue'
34
+ it_should_behave_like 'returndifferent_stringkey_objectvalue'
35
+ it_should_behave_like 'returndifferent_stringkey_stringvalue'
36
+ it_should_behave_like 'returndifferent_stringkey_hashvalue'
37
+ it_should_behave_like 'returndifferent_hashkey_objectvalue'
38
+ it_should_behave_like 'returndifferent_hashkey_stringvalue'
39
+ it_should_behave_like 'returndifferent_hashkey_hashvalue'
40
+ it_should_behave_like 'marshallable_key'
41
+ end
@@ -0,0 +1,41 @@
1
+ # Generated by generate.rb
2
+ require 'helper'
3
+
4
+ describe_juno "transformer_marshal_sha512" do
5
+ def new_store
6
+ Juno.build do
7
+ use :Transformer, :key => [:marshal, :sha512], :value => :marshal
8
+ adapter :Memory
9
+ end
10
+ end
11
+
12
+ include_context 'setup_store'
13
+ it_should_behave_like 'null_objectkey_objectvalue'
14
+ it_should_behave_like 'null_objectkey_stringvalue'
15
+ it_should_behave_like 'null_objectkey_hashvalue'
16
+ it_should_behave_like 'null_stringkey_objectvalue'
17
+ it_should_behave_like 'null_stringkey_stringvalue'
18
+ it_should_behave_like 'null_stringkey_hashvalue'
19
+ it_should_behave_like 'null_hashkey_objectvalue'
20
+ it_should_behave_like 'null_hashkey_stringvalue'
21
+ it_should_behave_like 'null_hashkey_hashvalue'
22
+ it_should_behave_like 'store_objectkey_objectvalue'
23
+ it_should_behave_like 'store_objectkey_stringvalue'
24
+ it_should_behave_like 'store_objectkey_hashvalue'
25
+ it_should_behave_like 'store_stringkey_objectvalue'
26
+ it_should_behave_like 'store_stringkey_stringvalue'
27
+ it_should_behave_like 'store_stringkey_hashvalue'
28
+ it_should_behave_like 'store_hashkey_objectvalue'
29
+ it_should_behave_like 'store_hashkey_stringvalue'
30
+ it_should_behave_like 'store_hashkey_hashvalue'
31
+ it_should_behave_like 'returndifferent_objectkey_objectvalue'
32
+ it_should_behave_like 'returndifferent_objectkey_stringvalue'
33
+ it_should_behave_like 'returndifferent_objectkey_hashvalue'
34
+ it_should_behave_like 'returndifferent_stringkey_objectvalue'
35
+ it_should_behave_like 'returndifferent_stringkey_stringvalue'
36
+ it_should_behave_like 'returndifferent_stringkey_hashvalue'
37
+ it_should_behave_like 'returndifferent_hashkey_objectvalue'
38
+ it_should_behave_like 'returndifferent_hashkey_stringvalue'
39
+ it_should_behave_like 'returndifferent_hashkey_hashvalue'
40
+ it_should_behave_like 'marshallable_key'
41
+ end
@@ -1,10 +1,10 @@
1
1
  # Generated by generate.rb
2
2
  require 'helper'
3
3
 
4
- describe_juno "transformer_compress" do
4
+ describe_juno "transformer_zlib" do
5
5
  def new_store
6
6
  Juno.build do
7
- use :Transformer, :value => :compress
7
+ use :Transformer, :value => :zlib
8
8
  adapter :Memory
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: juno
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-12-10 00:00:00.000000000 Z
14
+ date: 2012-12-12 00:00:00.000000000 Z
15
15
  dependencies: []
16
16
  description: A unified interface to key/value stores (moneta replacement)
17
17
  email:
@@ -131,7 +131,14 @@ files:
131
131
  - spec/juno/simple_memcached_native_spec.rb
132
132
  - spec/juno/simple_memcached_spec.rb
133
133
  - spec/juno/simple_memory_spec.rb
134
+ - spec/juno/simple_memory_with_compress_spec.rb
134
135
  - spec/juno/simple_memory_with_expires_spec.rb
136
+ - spec/juno/simple_memory_with_json_key_serializer_spec.rb
137
+ - spec/juno/simple_memory_with_json_md5_key_serializer_spec.rb
138
+ - spec/juno/simple_memory_with_json_serializer_spec.rb
139
+ - spec/juno/simple_memory_with_json_value_serializer_spec.rb
140
+ - spec/juno/simple_memory_with_prefix_spec.rb
141
+ - spec/juno/simple_memory_with_quicklz_compress_spec.rb
135
142
  - spec/juno/simple_mongo_spec.rb
136
143
  - spec/juno/simple_mongo_with_expires_spec.rb
137
144
  - spec/juno/simple_null_spec.rb
@@ -155,7 +162,6 @@ files:
155
162
  - spec/juno/transformer_bencode_spec.rb
156
163
  - spec/juno/transformer_bert_spec.rb
157
164
  - spec/juno/transformer_bson_spec.rb
158
- - spec/juno/transformer_compress_spec.rb
159
165
  - spec/juno/transformer_json_spec.rb
160
166
  - spec/juno/transformer_lzma_spec.rb
161
167
  - spec/juno/transformer_lzo_spec.rb
@@ -164,6 +170,11 @@ files:
164
170
  - spec/juno/transformer_marshal_md5_spec.rb
165
171
  - spec/juno/transformer_marshal_md5_spread_spec.rb
166
172
  - spec/juno/transformer_marshal_prefix_spec.rb
173
+ - spec/juno/transformer_marshal_rmd160_spec.rb
174
+ - spec/juno/transformer_marshal_sha1_spec.rb
175
+ - spec/juno/transformer_marshal_sha256_spec.rb
176
+ - spec/juno/transformer_marshal_sha384_spec.rb
177
+ - spec/juno/transformer_marshal_sha512_spec.rb
167
178
  - spec/juno/transformer_marshal_uuencode_spec.rb
168
179
  - spec/juno/transformer_msgpack_spec.rb
169
180
  - spec/juno/transformer_ox_spec.rb
@@ -171,6 +182,7 @@ files:
171
182
  - spec/juno/transformer_snappy_spec.rb
172
183
  - spec/juno/transformer_tnet_spec.rb
173
184
  - spec/juno/transformer_yaml_spec.rb
185
+ - spec/juno/transformer_zlib_spec.rb
174
186
  - spec/junospecs.rb
175
187
  - spec/rack/cache_juno_spec.rb
176
188
  - spec/rack/session_juno_spec.rb
@@ -260,7 +272,14 @@ test_files:
260
272
  - spec/juno/simple_memcached_native_spec.rb
261
273
  - spec/juno/simple_memcached_spec.rb
262
274
  - spec/juno/simple_memory_spec.rb
275
+ - spec/juno/simple_memory_with_compress_spec.rb
263
276
  - spec/juno/simple_memory_with_expires_spec.rb
277
+ - spec/juno/simple_memory_with_json_key_serializer_spec.rb
278
+ - spec/juno/simple_memory_with_json_md5_key_serializer_spec.rb
279
+ - spec/juno/simple_memory_with_json_serializer_spec.rb
280
+ - spec/juno/simple_memory_with_json_value_serializer_spec.rb
281
+ - spec/juno/simple_memory_with_prefix_spec.rb
282
+ - spec/juno/simple_memory_with_quicklz_compress_spec.rb
264
283
  - spec/juno/simple_mongo_spec.rb
265
284
  - spec/juno/simple_mongo_with_expires_spec.rb
266
285
  - spec/juno/simple_null_spec.rb
@@ -284,7 +303,6 @@ test_files:
284
303
  - spec/juno/transformer_bencode_spec.rb
285
304
  - spec/juno/transformer_bert_spec.rb
286
305
  - spec/juno/transformer_bson_spec.rb
287
- - spec/juno/transformer_compress_spec.rb
288
306
  - spec/juno/transformer_json_spec.rb
289
307
  - spec/juno/transformer_lzma_spec.rb
290
308
  - spec/juno/transformer_lzo_spec.rb
@@ -293,6 +311,11 @@ test_files:
293
311
  - spec/juno/transformer_marshal_md5_spec.rb
294
312
  - spec/juno/transformer_marshal_md5_spread_spec.rb
295
313
  - spec/juno/transformer_marshal_prefix_spec.rb
314
+ - spec/juno/transformer_marshal_rmd160_spec.rb
315
+ - spec/juno/transformer_marshal_sha1_spec.rb
316
+ - spec/juno/transformer_marshal_sha256_spec.rb
317
+ - spec/juno/transformer_marshal_sha384_spec.rb
318
+ - spec/juno/transformer_marshal_sha512_spec.rb
296
319
  - spec/juno/transformer_marshal_uuencode_spec.rb
297
320
  - spec/juno/transformer_msgpack_spec.rb
298
321
  - spec/juno/transformer_ox_spec.rb
@@ -300,6 +323,7 @@ test_files:
300
323
  - spec/juno/transformer_snappy_spec.rb
301
324
  - spec/juno/transformer_tnet_spec.rb
302
325
  - spec/juno/transformer_yaml_spec.rb
326
+ - spec/juno/transformer_zlib_spec.rb
303
327
  - spec/junospecs.rb
304
328
  - spec/rack/cache_juno_spec.rb
305
329
  - spec/rack/session_juno_spec.rb