syncache 1.3 → 1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +18 -0
- data/bin/syncache-drb +18 -7
- data/lib/syncache/remote.rb +3 -3
- data/man/syncache-drb.1 +4 -1
- data/syncache.gemspec +5 -3
- data/test/ts_syncache.rb +0 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c487d4bfefbcf5d5e454a7e2f8327ddac723078b
|
4
|
+
data.tar.gz: 143b0b8757fe2e0c37b18d3d74e10c9287b2c360
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49a98a66e098c88d99b4eac27c226d258ba93576ec7d24c6aa4d2f8f59cb8a149606ac455c6c6e747fd07dd789a7ba0c47c55fd473a1342c1d9370148ce89239
|
7
|
+
data.tar.gz: fa146f3504e6c3b782fbbe6a347a02242a549f3e3bb1098ed8540df20cc23aa87192977815195261d3f17d65c34c1f335808b83b1e3ce170bbb6d5f51466a078
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# SynCache dRuby object cache server
|
2
|
+
# (originally written for Samizdat project)
|
3
|
+
#
|
4
|
+
# Copyright (c) 2002-2012, 2016 Dmitry Borodaenko <angdraug@debian.org>
|
5
|
+
#
|
6
|
+
# This program is free software.
|
7
|
+
# You can distribute/modify this program under the terms of
|
8
|
+
# the GNU General Public License version 3 or later.
|
9
|
+
#
|
10
|
+
# vim: et sw=2 sts=2 ts=8 tw=0
|
11
|
+
|
12
|
+
require "rake"
|
13
|
+
|
14
|
+
task :default => :test
|
15
|
+
|
16
|
+
task :test do
|
17
|
+
sh %{#{FileUtils::RUBY} -I. -Ilib test/ts_syncache.rb}
|
18
|
+
end
|
data/bin/syncache-drb
CHANGED
@@ -28,7 +28,7 @@ Options:
|
|
28
28
|
|
29
29
|
URI
|
30
30
|
URI with druby: schema that DRb server binds to, default is
|
31
|
-
druby
|
31
|
+
druby://*:9000
|
32
32
|
|
33
33
|
--help
|
34
34
|
display this message and quit
|
@@ -60,6 +60,10 @@ Options:
|
|
60
60
|
/var/run/#{PNAME}/ when run as root, or under $TMPDIR
|
61
61
|
otherwise. Location should be writeable by USER.
|
62
62
|
|
63
|
+
--foreground
|
64
|
+
Do not daemonize, switch to a different user, create pidfile,
|
65
|
+
redirect output, or log to syslog.
|
66
|
+
|
63
67
|
}
|
64
68
|
exit
|
65
69
|
end
|
@@ -73,10 +77,11 @@ Options:
|
|
73
77
|
[ '--user', '-u', GetoptLong::REQUIRED_ARGUMENT ],
|
74
78
|
[ '--error-log', '-e', GetoptLong::REQUIRED_ARGUMENT ],
|
75
79
|
[ '--debug', '-d', GetoptLong::NO_ARGUMENT ],
|
76
|
-
[ '--pidfile', '-p', GetoptLong::REQUIRED_ARGUMENT ]
|
80
|
+
[ '--pidfile', '-p', GetoptLong::REQUIRED_ARGUMENT ],
|
81
|
+
[ '--foreground', GetoptLong::NO_ARGUMENT ]
|
77
82
|
)
|
78
83
|
|
79
|
-
@uri = 'druby
|
84
|
+
@uri = 'druby://*:9000'
|
80
85
|
@ttl = 24*60*60
|
81
86
|
@size = 10000
|
82
87
|
@flush_delay = nil
|
@@ -85,7 +90,9 @@ Options:
|
|
85
90
|
@debug = false
|
86
91
|
@pidfile = (0 == Process.uid) ?
|
87
92
|
"/var/run/#{PNAME}/#{PNAME}.pid" :
|
88
|
-
(ENV.has_key?('TMPDIR') ? ENV['TMPDIR'] : '/tmp')
|
93
|
+
File.join((ENV.has_key?('TMPDIR') ? ENV['TMPDIR'].dup.untaint : '/tmp'),
|
94
|
+
"#{PNAME}.pid")
|
95
|
+
@foreground = false
|
89
96
|
|
90
97
|
opts.each do |opt, arg|
|
91
98
|
case opt
|
@@ -105,6 +112,8 @@ Options:
|
|
105
112
|
@debug = true
|
106
113
|
when '--pidfile'
|
107
114
|
@pidfile = arg.dup.untaint
|
115
|
+
when '--foreground'
|
116
|
+
@foreground = true
|
108
117
|
end
|
109
118
|
end
|
110
119
|
|
@@ -183,14 +192,16 @@ Options:
|
|
183
192
|
|
184
193
|
def wait_for_shutdown
|
185
194
|
DRb.thread.join
|
186
|
-
File.delete @pidfile
|
195
|
+
File.delete @pidfile unless @foreground
|
187
196
|
log 'shut down'
|
188
197
|
end
|
189
198
|
|
190
199
|
def run
|
191
200
|
set_options
|
192
|
-
|
193
|
-
|
201
|
+
unless @foreground
|
202
|
+
daemonize
|
203
|
+
open_syslog unless @debug and @error_log
|
204
|
+
end
|
194
205
|
begin
|
195
206
|
ready
|
196
207
|
trap_signals
|
data/lib/syncache/remote.rb
CHANGED
@@ -74,9 +74,9 @@ class RemoteCache
|
|
74
74
|
value = @cache[key]
|
75
75
|
end
|
76
76
|
|
77
|
-
if value.kind_of?(Placeholder)
|
78
|
-
#
|
79
|
-
|
77
|
+
if value.kind_of?(Placeholder) or value.nil?
|
78
|
+
# the other client timed out or got flushed;
|
79
|
+
# reset the placeholder ttl and do it ourselves
|
80
80
|
@cache[key] = Placeholder.new
|
81
81
|
value = @cache[key] = yield
|
82
82
|
end
|
data/man/syncache-drb.1
CHANGED
@@ -14,7 +14,7 @@ replacement strategy.
|
|
14
14
|
.SH "OPTIONS"
|
15
15
|
.IP "\fBURI\fP" 4
|
16
16
|
A URI with druby: schema that the DRb server binds to, default is
|
17
|
-
\fBdruby
|
17
|
+
\fBdruby://*:9000\fP
|
18
18
|
.IP "\fB--help\fP" 4
|
19
19
|
Display usage information and quit.
|
20
20
|
.IP "\fB--ttl\fP SECONDS" 4
|
@@ -36,6 +36,9 @@ messages will be sent there instead of syslog.
|
|
36
36
|
Path to pidfile. By default, pidfile is created under /var/run/syncache-drb/
|
37
37
|
when run as root, or under $TMPDIR otherwise. Location should be writeable by
|
38
38
|
USER.
|
39
|
+
.IP "\fB--foreground\fP" 4
|
40
|
+
Do not daemonize, switch to a different user, create pidfile, redirect output,
|
41
|
+
or log to syslog.
|
39
42
|
|
40
43
|
.SH "AUTHOR"
|
41
44
|
.PP
|
data/syncache.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = 'syncache'
|
3
|
-
spec.version = '1.
|
3
|
+
spec.version = '1.4'
|
4
4
|
spec.author = 'Dmitry Borodaenko'
|
5
5
|
spec.email = 'angdraug@debian.org'
|
6
6
|
spec.homepage = 'https://github.com/angdraug/syncache'
|
@@ -18,8 +18,10 @@ two-level locking mechanism which ensures that:
|
|
18
18
|
and as soon as the first thread completes the operation, the result will be
|
19
19
|
returned to all threads.
|
20
20
|
EOF
|
21
|
-
spec.files =
|
21
|
+
spec.files = %w(COPYING ChangeLog.mtn README.rdoc setup.rb Rakefile
|
22
|
+
syncache.gemspec bin/syncache-drb man/syncache-drb.1) +
|
23
|
+
Dir['{lib,test}/**/*.rb']
|
22
24
|
spec.test_files = Dir['test/ts_*.rb']
|
23
25
|
spec.executables = spec.files.map{|p| p =~ /^bin\/(.*)/ ? $1 : nil }.compact
|
24
|
-
spec.license = '
|
26
|
+
spec.license = 'GPL-3.0+'
|
25
27
|
end
|
data/test/ts_syncache.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: syncache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Borodaenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
SynCache stores cached objects in a Hash that is protected by an advanced
|
@@ -31,6 +31,7 @@ files:
|
|
31
31
|
- COPYING
|
32
32
|
- ChangeLog.mtn
|
33
33
|
- README.rdoc
|
34
|
+
- Rakefile
|
34
35
|
- bin/syncache-drb
|
35
36
|
- lib/syncache.rb
|
36
37
|
- lib/syncache/remote.rb
|
@@ -43,7 +44,7 @@ files:
|
|
43
44
|
- test/ts_syncache.rb
|
44
45
|
homepage: https://github.com/angdraug/syncache
|
45
46
|
licenses:
|
46
|
-
-
|
47
|
+
- GPL-3.0+
|
47
48
|
metadata: {}
|
48
49
|
post_install_message:
|
49
50
|
rdoc_options: []
|
@@ -61,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
62
|
version: '0'
|
62
63
|
requirements: []
|
63
64
|
rubyforge_project:
|
64
|
-
rubygems_version: 2.
|
65
|
+
rubygems_version: 2.5.1
|
65
66
|
signing_key:
|
66
67
|
specification_version: 4
|
67
68
|
summary: Thread-safe time-limited cache with flexible replacement policy
|