1
0
Fork 0
mirror of synced 2025-04-01 12:26:11 +03:00

#1169 DDC-3343 - factoring logging into cached collection persister changes

This commit is contained in:
Marco Pivetta 2015-01-25 04:45:45 +01:00
parent 7e85c94f48
commit cb780e8bb6

View file

@ -271,11 +271,17 @@ abstract class AbstractCollectionPersister implements CachedCollectionPersister
*/
protected function evictCollectionCache(PersistentCollection $collection)
{
$this->region->evict(new CollectionCacheKey(
$key = new CollectionCacheKey(
$this->sourceEntity->rootEntityName,
$this->association['fieldName'],
$this->uow->getEntityIdentifier($collection->getOwner())
));
);
$this->region->evict($key);
if ($this->cacheLogger) {
$this->cacheLogger->collectionCachePut($this->regionName, $key);
}
}
/**
@ -286,10 +292,13 @@ abstract class AbstractCollectionPersister implements CachedCollectionPersister
{
/* @var $targetPersister CachedEntityPersister */
$targetPersister = $this->uow->getEntityPersister($targetEntity);
$targetRegion = $targetPersister->getCacheRegion();
$key = new EntityCacheKey($targetEntity, $this->uow->getEntityIdentifier($element));
$targetPersister->getCacheRegion()->evict(new EntityCacheKey(
$targetEntity,
$this->uow->getEntityIdentifier($element)
));
$targetRegion->evict($key);
if ($this->cacheLogger) {
$this->cacheLogger->entityCachePut($targetRegion->getName(), $key);
}
}
}