public function remove($guid)
{
$guid = (int) $guid;
if (!isset($this->entities[$guid])) {
return;
}
unset($this->entities[$guid]);
$username = array_search($guid, $this->username_cache);
if ($username !== false) {
unset($this->username_cache[$username]);
}
// Purge separate metadata cache. Original idea was to do in entity destructor, but that would
// have caused a bunch of unnecessary purges at every shutdown. Doing it this way we have no way
// to know that the expunged entity will be GCed (might be another reference living), but that's
// OK; the metadata will reload if necessary.
$this->metadata_cache->clear($guid);
}