Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/cache/cache_pools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ item in the cache immediately (it returns ``true`` if the item was saved or
``false`` if some error occurred)::

// ...
$userFriends = $cache->get('user_'.$userId.'_friends');
$userFriends = $cache->getItem('user_'.$userId.'_friends');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now also need to call get() on the return value (the cache pool does not return the cached value, but a CacheItemInterface instance).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just about saving cache items.

I don't think it is necessary to get the value if you just want to save the value into cache.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah indeed, I misread the following code.

$userFriends->set($user->getFriends());
$isSaved = $cache->save($userFriends);

Expand Down