Example #1
0
 /**
  * Stores Aggregate or Entity in Cache
  * We don't differ Entities from Aggregates because the caching algorithm is the same
  * @see http://www.smira.ru/2008/10/29/web-caching-memcached-5/
  *
  * @param Business $object Entity or Aggregate object
  */
 protected function saveCached(Business $object)
 {
     $cacheKey = $object->getCacheKey();
     if (null !== $cacheKey) {
         $Cache = Manager::getInstance()->getCache();
         //reset only for entities
         if ($object instanceof Entity) {
             $Cache->deleteEntity($object);
         }
         $Cache->set($object);
     }
 }
Example #2
0
 /**
  * @param Business $business
  */
 public function set(Business $business)
 {
     $key = $this->generator->generate($business->getCacheKey());
     $this->adapter->set($key, $this->packer->pack($business), $business->getExpires());
 }