Memcached cache adapter keeps items whose TTL has expired
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
從 MemcachedAdapter::set() 及其 normalizeTtl() 輔助方法開始,並閱讀 RedisAdapter::set() 以了解這個 issue 說要複製的模式。當正規化後的 TTL 為 0 或更小時,加入提前刪除並傳回 true 的路徑,然後撰寫測試,涵蓋負 TTL 和過去的 DateInterval。當這樣的 set() 之後 get() 傳回 null,且 setMultiple() 透過 set() 表現相同時,即完成。
由索引模型根據 Issue 內容生成。
描述
Summary
MemcachedAdapter::set() keeps an item forever when its TTL is zero or negative, or when a DateInterval TTL lies in the past. PSR-16 says such an item must be deleted from the cache.
Cause
normalizeTtl() clamps an expired TTL to 0, and Memcached reads an expiration of 0 as "never expire". RedisAdapter::set() already handles it: when the TTL is 0 or less it deletes the key and returns true.
Reproduce
$cache = cache('memcached');
$cache->set('key', 'value', -1);
$cache->get('key'); // 'value' with Memcached, null with Redis
Fix
In MemcachedAdapter::set(), delete the key and return true when the TTL is 0 or less, as RedisAdapter does, with a test for a negative TTL and for a DateInterval in the past. setMultiple() goes through set(), so it is covered too.
The bug is in 3.1.x as well; it is fixed in 3.2.0.
- 主要語言
- PHP
- 星號
- 43
- 分支
- 22
- 平均合併
- 54 分鐘
- 30 天內合併 PR
- 57
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
quantum-php/framework 的其他 Issue
-
routing testing
難度 2/5 1-3 小時 新手友好度 76/100
quantum-php/framework#547 ·
維護者通常 1 天內回覆
-
bug
難度 3/5 1-2 天 新手友好度 72/100
quantum-php/framework#694 ·
維護者通常 1 天內回覆
-
refactoring tech debt
難度 5/5 一週以上 新手友好度 20/100
quantum-php/framework#693 ·
維護者通常 1 天內回覆
-
install:debugbar reads the package folder from the working directory and uses the default storage adapter可能已有人在做 @armanist 今天認領。 未關閉bug console debugbar good first issue
quantum-php/framework#691 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
console enhancement
難度 4/5 3-5 天 新手友好度 74/100
quantum-php/framework#688 ·
維護者通常 1 天內回覆
查看 quantum-php/framework 的全部 Issue
相似的 Issue
-
難度 1/5 1 小時以內 新手友好度 70/100
ajeetraina/awesome-docker-sbx#559 ·
-
dependencies enhancement
難度 2/5 1-3 小時 新手友好度 68/100
novalo-dev/Prestashop-MCP-Server#329 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 80/100
維護者通常 1 天內回覆
-
bug origin:interactive status:available
難度 2/5 1-3 小時 新手友好度 62/100
Ultimate-Multisite/ultimate-multisite#2131 ·
維護者通常 1 天內回覆
-
sync-en
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆