Skip to content

Commit 0813be0

Browse files
committed
minor #9736 Item key for deletion (Guikingone)
This PR was merged into the 3.4 branch. Discussion ---------- Item key for deletion Hi, As the CacheItem return is key with `getKey()` method, it could be useful to use the method to delete the item. Commits ------- f59e8d8 (feat): Item key call for deletion
2 parents d126b50 + f59e8d8 commit 0813be0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

components/cache/cache_invalidation.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ you can invalidate the cached items by calling
4848
// if you know the cache key, you can also delete the item directly
4949
$cache->deleteItem('cache_key');
5050

51+
// If you don't remember the item key, you can use the getKey() method
52+
$cache->deleteItem($item->getKey());
53+
5154
Using tags invalidation is very useful when tracking cache keys becomes difficult.
5255

5356
Tag Aware Adapters

0 commit comments

Comments
 (0)