Skip to content

Instantly share code, notes, and snippets.

@mikemix
Created November 11, 2022 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikemix/2ef9f5dd4a82bc392c19151862770b9c to your computer and use it in GitHub Desktop.
Save mikemix/2ef9f5dd4a82bc392c19151862770b9c to your computer and use it in GitHub Desktop.
<?php
$cache = $entityManager->getCache();
// prune entity cache
$cache->evictEntity(User::class, $user->getId());
// prune entity's relationship cache
$cache->evictCollection(User::class, 'posts', $user->getId());
// prune entire region of a relationship
$cache->evictCollectionRegion(User::class, 'posts');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment