2012-05-29 37 views
0

我將一個包含29個元素的數組保存在一個memcache鍵'getBannerInfo'中。該數組是這樣的:將數組存儲在使用PHP的memcache中,數組元素在memcache某段時間後取消設置

[bannerid] => 5059 
[campaignid] => 2687 
[contenttype] => png 
[storagetype] => url 
[filename] => 
[imageurl] => http://testanalyst.org/c2687/13381938962791_50x50.png 
[htmltemplate] => 
[htmlcache] => 
[append] => 
[width] => 50 
[height] => 50 
[weight] => 1 
[url] => http://www.google.com 
[alt] => new image 
[bannertext] => New image 
[description] => test image alt text 23 
[autohtml] => f 
[alt_contenttype] => 
[comments] => 
[status] => 0 
[compiledlimitation] => xyz 
[acl_plugins] => lmn 
[acls_updated] => 2012-05-28 16:49:02 
[parameters] => N; 
[custom_data] => abc 
[target] => 
[capping] => 0 
[block] => 0 
[is_deleted] => 0 

現在,奇怪的品行,我注意到,allthough最初它被設置爲預期,但一段時間後,時,從內存緩存鍵獲取數據時,ALT關鍵=> val對不在提取的數組中。

我使用

set($key,$arrayName,3600); and get($key) 
內存緩存擴展類的

爲什麼會發生這種情況與alt特別關鍵,我已經添加到這個陣列最近,這個問題已被注意到。

+0

鑑於memcache存儲像這樣的數據,我無法將其看作memcache問題。是否有可能你在代碼中的其他地方存儲這個數組減去alt鍵? –

回答

0

緩存只是一個臨時緩衝區,它可以刪除記錄,如果空間不足或記錄過期。這是預期的行爲。如果您需要持久存儲,請使用數據庫。

+0

由於數組以串行化字符串形式存儲,因此整個字符串將被刪除,而不僅僅是「alt」鍵部分 – Esailija

相關問題