xunch 0.0.10.1 → 0.0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/xunch/cache/cache_builder.rb +13 -4
- data/lib/xunch/shard/redis.rb +1 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2745b0a105ccb0dfa6461af733d0a544719ce442
|
4
|
+
data.tar.gz: da52e284ba4cc556b1f8addfbdccf0f5f2be21ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
39
|
-
|
40
|
-
|
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
|
data/lib/xunch/shard/redis.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2014-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|