Storm\Api\Base\IdentityMap::CacheEntity PHP Метод

CacheEntity() закрытый публичный Метод

final public CacheEntity ( $Entity, Identity $Identity = null )
$Identity Storm\Core\Object\Identity
    public final function CacheEntity($Entity, Object\Identity $Identity = null)
    {
        $Identity = $Identity ?: $this->EntityMap->Identity($Entity);
        $IdentityHash = $Identity->Hash();
        $this->Cache->Save($IdentityHash, $Entity);
    }

Usage Example

Пример #1
0
 /**
  * Adds an entity to the persistence queue. 
  * If AutoSave is enabled, the action will be commited.
  * 
  * @param object $Entity The entity to persist
  * @return void
  */
 public function Persist($Entity)
 {
     $this->VerifyEntity(__METHOD__, $Entity);
     $this->IdentityMap->CacheEntity($Entity);
     $this->PersistedQueue[] = $Entity;
     $this->AutoSave();
 }