tokyo_cache_cow 0.0.9 → 0.0.10
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.
- data/VERSION.yml +1 -1
- data/lib/tokyo_cache_cow/runner.rb +2 -2
- data/lib/tokyo_cache_cow/server.rb +18 -15
- metadata +3 -3
data/VERSION.yml
CHANGED
@@ -41,7 +41,7 @@ class TokyoCacheCow
|
|
41
41
|
end
|
42
42
|
|
43
43
|
opts.on("-c[OPTIONAL]", "--class", "Cache provider class (default: #{options[:class]})") do |v|
|
44
|
-
options[:
|
44
|
+
options[:class] = v
|
45
45
|
end
|
46
46
|
|
47
47
|
opts.on("-r[OPTIONAL]", "--require", "require") do |v|
|
@@ -90,7 +90,7 @@ class TokyoCacheCow
|
|
90
90
|
puts "Starting the tokyo cache cow #{address} #{port}"
|
91
91
|
pid = EM.fork_reactor do
|
92
92
|
cache = clazz.new(:file => @options[:file])
|
93
|
-
cache.marshalling_enabled =
|
93
|
+
cache.marshalling_enabled = options[:marshalling]
|
94
94
|
trap("INT") { EM.stop; puts "\nmoooooooo ya later"; exit(0)}
|
95
95
|
EM.run do
|
96
96
|
EM.start_server(address, port, TokyoCacheCow::Server) do |c|
|
@@ -170,23 +170,26 @@ class TokyoCacheCow
|
|
170
170
|
when 'cas'
|
171
171
|
# do something
|
172
172
|
when 'delete'
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
173
|
+
split_args = args.split(/\s+/)
|
174
|
+
(key, timeout, noreply) = case split_args.size
|
175
|
+
when 2
|
176
|
+
[split_args[0].chomp, 0, !split_args[1].nil?]
|
177
|
+
when 3
|
178
|
+
[split_args[0].chomp, split_args[1].to_i, !split_args[2].nil?]
|
179
|
+
else
|
180
|
+
(send_client_error and next)
|
181
|
+
end
|
182
|
+
next unless validate_key(key)
|
183
|
+
if special_match_char && key.index(special_match_char) == 0
|
184
|
+
key.slice!(0,special_match_char.size)
|
185
|
+
@cache.delete_match(key)
|
186
|
+
send_data(DeletedReply)
|
187
|
+
elsif timeout == 0
|
188
|
+
send_data @cache.delete(key) ?
|
189
|
+
DeletedReply : NotDeletedReply
|
190
|
+
else
|
177
191
|
send_data(@cache.delete_expire(key, timeout) ?
|
178
192
|
DeletedReply : NotDeletedReply)
|
179
|
-
when DeleteCommand
|
180
|
-
(key, noreply) = [$1.chomp, !$2.nil?]
|
181
|
-
next unless validate_key(key)
|
182
|
-
if special_match_char && key.index(special_match_char) == 0
|
183
|
-
key.slice!(0,special_match_char.size)
|
184
|
-
@cache.delete_match(key)
|
185
|
-
send_data(DeletedReply)
|
186
|
-
else
|
187
|
-
send_data @cache.delete(key) ?
|
188
|
-
DeletedReply : NotDeletedReply
|
189
|
-
end
|
190
193
|
end
|
191
194
|
when 'delete_match'
|
192
195
|
DeleteMatchCommand.match(args)
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 10
|
9
|
+
version: 0.0.10
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Joshua Hull
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-04-12 00:00:00 -04:00
|
18
18
|
default_executable: tokyo_cache_cow
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|