Explorar o código

remove cache of Store driver for File

walkor %!s(int64=11) %!d(string=hai) anos
pai
achega
a996ac4f47
Modificáronse 1 ficheiros con 3 adicións e 9 borrados
  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;
     }