sinatra-diskcache 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sinatra/diskcache.rb +5 -2
- data/lib/sinatra/version.rb +1 -1
- metadata +2 -2
data/lib/sinatra/diskcache.rb
CHANGED
@@ -45,7 +45,7 @@ module Sinatra
|
|
45
45
|
def cache_get filename
|
46
46
|
filepath = path_to filename
|
47
47
|
|
48
|
-
if
|
48
|
+
if File.exist? filepath and File.size?( filepath ) == 0 and settings.diskcache_empty_cleanup
|
49
49
|
cache_log "#{filename} is empty, wiping"
|
50
50
|
File.delete filepath
|
51
51
|
nil
|
@@ -53,15 +53,18 @@ module Sinatra
|
|
53
53
|
if ( File.ctime( filepath ) + settings.diskcache_expiry_period > Time.now ) or not settings.diskcache_expiry_enabled
|
54
54
|
begin
|
55
55
|
cache_log "found unexpirable file #{filepath}"
|
56
|
-
return File.
|
56
|
+
return File.open filepath, 'r'
|
57
57
|
rescue IOError => e
|
58
58
|
cache_log "can't open #{filename}, skipping"
|
59
|
+
nil
|
59
60
|
end
|
60
61
|
else
|
61
62
|
cache_log "#{filename} expired, wiping"
|
62
63
|
File.delete filepath
|
63
64
|
nil
|
64
65
|
end
|
66
|
+
else
|
67
|
+
nil
|
65
68
|
end
|
66
69
|
end
|
67
70
|
end
|
data/lib/sinatra/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-diskcache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-26 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Allows to cache heavy-load query results on the disk
|
15
15
|
email:
|