rbbt-util 5.19.25 → 5.19.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/persist/tsv/adapter.rb +21 -21
- data/lib/rbbt/util/tc_cache.rb +11 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 669dc64f2ded00cb9c68d0dd097daea6e16d7553
|
4
|
+
data.tar.gz: 0d713150486dae17078a6ac1b40a3e47ed6c1fe2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f5e2fef698efb2fce69cf438f111cb76f6d2bb3e5714d1a318a73cdc6d99bce4d88cc11c2beecbf51e6f49278eb90a4886862325c6e7600281747c8500067f2
|
7
|
+
data.tar.gz: 2ef394d6ed09abc4295a5dcc65f420619dbb8d90d3966780dbd3091c558d2581c3c2cbd739362c0df7a09bed70e2d6eab5133423e5c153f3376a23188a8a4351
|
@@ -55,34 +55,34 @@ module Persist
|
|
55
55
|
def write_and_read
|
56
56
|
lock_filename = Persist.persistence_path(persistence_path + '.write', {:dir => TSV.lock_dir})
|
57
57
|
#mutex.synchronize do
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
58
|
+
Misc.lock(lock_filename) do
|
59
|
+
write if closed? or not write?
|
60
|
+
res = begin
|
61
|
+
yield
|
62
|
+
ensure
|
63
|
+
read
|
64
|
+
end
|
65
|
+
res
|
66
|
+
end
|
67
67
|
#end
|
68
68
|
end
|
69
69
|
|
70
70
|
def write_and_close
|
71
71
|
lock_filename = Persist.persistence_path(persistence_path + '.write', {:dir => TSV.lock_dir})
|
72
72
|
#mutex.synchronize do
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
end
|
73
|
+
Misc.lock(lock_filename, true) do
|
74
|
+
write if closed? or not write?
|
75
|
+
res = begin
|
76
|
+
yield
|
77
|
+
rescue Exception
|
78
|
+
Log.exception $!
|
79
|
+
raise $!
|
80
|
+
ensure
|
81
|
+
close
|
82
|
+
end
|
83
|
+
res
|
85
84
|
#end
|
85
|
+
end
|
86
86
|
end
|
87
87
|
|
88
88
|
def read_and_close
|
data/lib/rbbt/util/tc_cache.rb
CHANGED
@@ -7,12 +7,17 @@ module TCCache
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def cache(key)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
self.write_and_read do
|
14
|
-
self[key] = yield
|
15
|
-
end
|
10
|
+
|
11
|
+
self.read_and_close do
|
12
|
+
return self[key] if self.include? key
|
16
13
|
end
|
14
|
+
|
15
|
+
value = yield
|
16
|
+
|
17
|
+
self.write_and_close do
|
18
|
+
self[key] = value
|
19
|
+
end
|
20
|
+
|
21
|
+
value
|
17
22
|
end
|
18
23
|
end
|