예제 #1
0
 /**
  * Calculates if the cache content needs to be used
  * @return boolean
  */
 function MustUseCache()
 {
     if ($this->cacheLifetime == 0) {
         return false;
     }
     if (!File::Exists($this->file)) {
         return false;
     }
     $now = Date::Now();
     $lastMod = File::GetLastModified($this->file);
     if ($now->TimeStamp() - $lastMod->TimeStamp() < $this->cacheLifetime) {
         return true;
     }
     return false;
 }
예제 #2
0
 /**
  * True if cache file contents must be used
  * @param strinh $cacheFile The cache file
  * @return boolean
  */
 private function MustUseCache($cacheFile)
 {
     $seconds = $this->content->GetCacheLifetime();
     if ($seconds == 0) {
         return false;
     }
     if (!File::Exists($cacheFile)) {
         return false;
     }
     $now = Date::Now();
     $lastMod = File::GetLastModified($cacheFile);
     if ($now->TimeStamp() - $lastMod->TimeStamp() < $seconds) {
         return true;
     }
     return false;
 }