diff --git a/lib/diskcached.rb b/lib/diskcached.rb index 263fb52..20a6d6b 100644 --- a/lib/diskcached.rb +++ b/lib/diskcached.rb @@ -45,11 +45,10 @@ def timeout=(t) @gc_time = t end - # return true if cache with 'key' is expired + # return true if cache with 'key' is expired or there is no cache entry def expired? key - return false if timeout.nil? mtime = read_cache_mtime(key) - return (mtime.nil? || mtime+timeout <= Time.now) + return mtime.nil? || (timeout && mtime+timeout <= Time.now) end # expire cache with 'key'