xunch 0.0.10.1 → 0.0.10.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4675154dcdab18efb9f40343df82ff35bd43e9f
4
- data.tar.gz: 47eba457b210aecbf72268eda35557b8f785bf57
3
+ metadata.gz: 2745b0a105ccb0dfa6461af733d0a544719ce442
4
+ data.tar.gz: da52e284ba4cc556b1f8addfbdccf0f5f2be21ff
5
5
  SHA512:
6
- metadata.gz: 1e029ca1ed83d478e0231305779ae280f332098fb0cdf3d721cc0c9ffea5b211f5ce839f85d3328230d47f6dfcf3c31accd31193a8754f42d94b39991b962a4d
7
- data.tar.gz: c424b62fef9d63c041332f59b3cb01bc47fa6ecf8f4f344649711ef6a4c4b9b6979bd4bf099f01a5f6e02dd365775186a02cdb5111b63c14557bbac69f72fd52
6
+ metadata.gz: 93c52651755a238ffb43edd2b6c3c8fab1ac0b6d5e857dcb3f58544d6689d104c2d7980c93ee88a7a34989cbcd20488d35d2532b929458ca61a37c77340f4d7f
7
+ data.tar.gz: bde5eaabfb9b5c9bf7c92591fd74093dee2f7fcf99af9a6297b6ee48d0edfc9499a63a23a1f8a2d6e330a74281c63d1cc525a207babf838fe6907db89846e0aa
@@ -27,7 +27,7 @@ module Xunch
27
27
  lazy_caches = {}
28
28
  cache_configs.each_value { |cache_config|
29
29
  shard_names = cache_config["shards"].split(",")
30
- driver = cache_config["driver"].to_sym if cache_config["driver"]
30
+ driver = cache_config["driver"].downcase.to_sym if cache_config["driver"]
31
31
  shard_infos = []
32
32
  shard_size = shard_names.size
33
33
  shard_names.each { |shard|
@@ -35,9 +35,18 @@ module Xunch
35
35
  shard_name = split[0]
36
36
  weight = split[1]
37
37
  shard_options = {}
38
- shard_options[:driver] = driver
39
- shard_options[:timeout] = cache_config["timeout"]
40
- shard_options[:size] = cache_config["size"] / shard_size
38
+ if driver
39
+ shard_options[:driver] = driver
40
+ end
41
+ if cache_config["timeout"]
42
+ shard_options[:timeout] = cache_config["timeout"]
43
+ end
44
+ if cache_config["size"]
45
+ shard_options[:size] = cache_config["size"] / shard_size
46
+ if shard_options[:size] == 0
47
+ shard_options[:size] = 1
48
+ end
49
+ end
41
50
  if weight
42
51
  shard_options[:weight] = weight.to_i
43
52
  end
@@ -12,25 +12,20 @@ module Xunch
12
12
  }
13
13
 
14
14
  def initialize(options = {})
15
- # puts options
16
15
  options = DEFAULTS.merge(options)
17
- # puts options
18
16
  if RUBY_PLATFORM =~ /mingw/
19
17
  options[:driver] = nil
20
18
  end
21
19
  if(options[:pool_timeout] <= 0)
22
20
  options[:pool_timeout] = 1073741823
23
21
  end
24
- # p options[:driver]
25
22
  last_driver = Redis::Connection.drivers.last.name
26
- options[:driver] ||= last_driver[last_driver.rindex(':') + 1, last_driver.length].to_sym
23
+ options[:driver] ||= last_driver[last_driver.rindex(':') + 1, last_driver.length].downcase.to_sym
27
24
  if options[:driver] == :synchrony
28
25
  require "xunch/connection/fiber_redis_pool"
29
- # puts "fiber pool"
30
26
  @pool = FiberRedisPool.new(options)
31
27
  else
32
28
  require "xunch/connection/threaded_redis_pool"
33
- # puts "threaded pool"
34
29
  @pool = ThreadedRedisPool.new(options)
35
30
  end
36
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xunch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10.1
4
+ version: 0.0.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ted Wang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-04 00:00:00.000000000 Z
11
+ date: 2014-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis