AppserverIo\Appserver\PersistenceContainer\Doctrine\V2\CacheFactories\CacheConfigurationNodeInterface::getFactory PHP Method

getFactory() public method

Return's the Doctrine query cache factory class.
public getFactory ( ) : string
return string The Doctrine query cache factory class
    public function getFactory();

Usage Example

 /**
  * Factory method to create a new cache instance from the passed configuration.
  *
  * @param \AppserverIo\Appserver\Core\Api\Node\PersistenceUnitNodeInterface                                    $persistenceUnit    The persistence unit node
  * @param \AppserverIo\Appserver\PersistenceContainer\Doctrine\V2\CacheFactory\CacheConfigurationNodeInterface $cacheConfiguration The cache configuration
  *
  * @return \Doctrine\Common\Cache\CacheProvider The cache instance
  */
 public static function getCacheImpl(PersistenceUnitNodeInterface $persistenceUnit, CacheConfigurationNodeInterface $cacheConfiguration)
 {
     // load the factory class
     $factory = $cacheConfiguration->getFactory();
     // create a cache instance
     $cache = $factory::get($cacheConfiguration->getParams());
     $cache->setNamespace(sprintf('dc2_%s_', md5($persistenceUnit->getName())));
     // return the cache instance
     return $cache;
 }