Skip to content

Commit

Permalink
#1169 DDC-3343 - factoring logging into cached collection persister c…
Browse files Browse the repository at this point in the history
…hanges
  • Loading branch information
Ocramius committed Jan 25, 2015
1 parent 7e85c94 commit cb780e8
Showing 1 changed file with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,17 @@ public function loadCriteria(PersistentCollection $collection, Criteria $criteri
*/
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);
}
}

/**
Expand All @@ -286,10 +292,13 @@ protected function evictElementCache($targetEntity, $element)
{
/* @var $targetPersister CachedEntityPersister */
$targetPersister = $this->uow->getEntityPersister($targetEntity);
$targetRegion = $targetPersister->getCacheRegion();
$key = new EntityCacheKey($targetEntity, $this->uow->getEntityIdentifier($element));

$targetRegion->evict($key);

$targetPersister->getCacheRegion()->evict(new EntityCacheKey(
$targetEntity,
$this->uow->getEntityIdentifier($element)
));
if ($this->cacheLogger) {
$this->cacheLogger->entityCachePut($targetRegion->getName(), $key);
}
}
}

0 comments on commit cb780e8

Please sign in to comment.