2013-08-22 46 views
0

問題標題基本上說,這一切..memcache保持信息,直到刷新?

如果我執行:

$Cache = new Memcache; 

$Cache->connect('HOST'); 


$Cache->set('Information', 'array(
"Testing" => "Value, 
"Anther_Test" => "Another Value" 

)'); 

並留下信息那裏,將信息刷新/間隔後刪除?

還是會在服務器上,直到我稱之爲內保留:

$Cache->flush(); 
+5

這取決於配置。我建議你閱讀一下有關memcache的內容,它是如何工作的以及如何配置的。 – hakre

+0

' '陣列( 「測試」=>「值, 「Anther_Test」=> 「另一值」 )''---這是一個reeeeeally怪異值 – zerkms

+0

@hakre我的當前窗口的二進制,它不不讓我訪問,甚至看不到配置文件..更不用說修改它們 –

回答

0

在評論中寫道什麼@hakre加上你應該如何使用緩存。 緩存不是日期存儲,它是緩存。你永遠不應該繼續傳遞什麼,什麼不是。 通常情況下,您有一個緩存大小的限制,並且當它滿了時清除舊值。

典型用法的情況下:

function get_something() { 
    $Cache = new Memcache; 
    $something = $Cache->get('something'); 
    if ($something === false) { 
     $something = //get from db, prepare or whatever 
     $Cache->set('something', $something); 
    } 
    return $something; 
} 

TLDR;沒有