hi...

i have implemented a onTop caching system for doctrine. if i get a entity 
from my cache system, i have to say doctrine that this entity have to 
managed. so i "merge" this on my entityManager. 

    public function getById($id, $cacheLifetime = null) {
        if ($this->useCache) {
            $cacheId = $this->generateCacheId($id);
            $object = $this->getResultCache()->fetch($cacheId);
            if ($object instanceof DBEntityInterface) {
                return $this->getEntityManager()->merge($object);
            }
        }
        $object = parent::getById($id); //get from DB
        if ($this->useCache && $object instanceof DBEntityInterface) {
            $this->saveToCache($object, is_int($cacheLifetime) ? 
$cacheLifetime : $this->getCacheLifetime());
            return $object;
        }
        return null;
    }

but this call:

    return $this->getEntityManager()->merge($object);

after get the object from the cache, will end in a "select" this entity 
from the database. this behavior is contra productiv for a caching system. 
how can i say doctrine, that this object from the cache is a valid entitiy 
without refetch?

any tips ?

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to