sinatra-diskcache 1.0.0 → 1.0.1

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.
@@ -45,7 +45,7 @@ module Sinatra
45
45
  def cache_get filename
46
46
  filepath = path_to filename
47
47
 
48
- if not ( File.size? filepath ) and settings.diskcache_empty_cleanup
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.new filepath, 'r'
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
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module DiskCache
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
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.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-10-05 00:00:00.000000000 Z
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: