Bläddra i källkod

remove cache of Store driver for File

walkor 11 år sedan
förälder
incheckning
a996ac4f47
1 ändrade filer med 3 tillägg och 9 borttagningar
  1. 3 9
      applications/Demo/Lib/StoreDriver/File.php

+ 3 - 9
applications/Demo/Lib/StoreDriver/File.php

@@ -20,9 +20,6 @@ class File
     // 打开文件的句柄
     protected $dataFileHandle = null;
     
-    // 缓存过期时间
-    const CACHE_EXP_TIME = 1;
-    
     /**
      * 构造函数
      * @param 配置名 $config_name
@@ -77,12 +74,9 @@ class File
      */
     public function get($key, $use_cache = true)
     {
-        if(!$use_cache || time() - $this->lastCacheTime > self::CACHE_EXP_TIME)
-        {
-            flock($this->dataFileHandle, LOCK_EX);
-            $this->readDataFromDisk();
-            flock($this->dataFileHandle, LOCK_UN);
-        }
+        flock($this->dataFileHandle, LOCK_EX);
+        $this->readDataFromDisk();
+        flock($this->dataFileHandle, LOCK_UN);
         return isset($this->dataCache[$key]) ? $this->dataCache[$key] : null;
     }