sinatra-diskcache 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sinatra/diskcache.rb +7 -1
- data/lib/sinatra/version.rb +1 -1
- data/sinatra-diskcache.gemspec +1 -1
- metadata +3 -3
data/lib/sinatra/diskcache.rb
CHANGED
@@ -44,7 +44,12 @@ module Sinatra
|
|
44
44
|
|
45
45
|
def cache_get filename
|
46
46
|
filepath = path_to filename
|
47
|
-
|
47
|
+
|
48
|
+
if not ( File.size? filename ) and settings.diskcache_empty_cleanup
|
49
|
+
cache_log "#{filename} is empty, wiping"
|
50
|
+
File.delete filepath
|
51
|
+
nil
|
52
|
+
elsif File.exist? filepath
|
48
53
|
if ( File.ctime( filepath ) + settings.diskcache_expiry_period > Time.now ) or not settings.diskcache_expiry_enabled
|
49
54
|
begin
|
50
55
|
cache_log "found unexpirable file #{filepath}"
|
@@ -68,6 +73,7 @@ module Sinatra
|
|
68
73
|
app.set :diskcache_enabled, true
|
69
74
|
app.set :diskcache_logging, true if app.development?
|
70
75
|
app.set :diskcache_expiry_enabled, true
|
76
|
+
app.set :diskcache_empty_cleanup, true
|
71
77
|
app.set :diskcache_expiry_period, 3600
|
72
78
|
app.set :diskcache_full_paths, true
|
73
79
|
app.set :diskcache_path, "./diskcache"
|
data/lib/sinatra/version.rb
CHANGED
data/sinatra-diskcache.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = Sinatra::DiskCache::VERSION
|
8
8
|
s.authors = ["Ilia Zhirov"]
|
9
9
|
s.email = ["izhirov@gmail.com"]
|
10
|
-
s.homepage = ""
|
10
|
+
s.homepage = "http://github.com/pixe1f10w/sinatra-diskcache"
|
11
11
|
s.summary = %q{Sinatra disk cache}
|
12
12
|
s.description = %q{Allows to cache heavy-load query results on the disk}
|
13
13
|
|
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: 0.0.
|
4
|
+
version: 0.0.3
|
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-07-11 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Allows to cache heavy-load query results on the disk
|
15
15
|
email:
|
@@ -24,7 +24,7 @@ files:
|
|
24
24
|
- lib/sinatra/diskcache.rb
|
25
25
|
- lib/sinatra/version.rb
|
26
26
|
- sinatra-diskcache.gemspec
|
27
|
-
homepage:
|
27
|
+
homepage: http://github.com/pixe1f10w/sinatra-diskcache
|
28
28
|
licenses: []
|
29
29
|
post_install_message:
|
30
30
|
rdoc_options: []
|