当前位置: 首页>>代码示例>>PHP>>正文


PHP EntityManagerInterface::getCache方法代码示例

本文整理汇总了PHP中Doctrine\ORM\EntityManagerInterface::getCache方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityManagerInterface::getCache方法的具体用法?PHP EntityManagerInterface::getCache怎么用?PHP EntityManagerInterface::getCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\ORM\EntityManagerInterface的用法示例。


在下文中一共展示了EntityManagerInterface::getCache方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: executeUsingQueryCache

 /**
  * Load from second level cache or executes the query and put into cache.
  *
  * @param ArrayCollection|array|null $parameters
  * @param integer|null               $hydrationMode
  *
  * @return mixed
  */
 private function executeUsingQueryCache($parameters = null, $hydrationMode = null)
 {
     $rsm = $this->getResultSetMapping();
     $querykey = new QueryCacheKey($this->getHash(), $this->lifetime, $this->cacheMode ?: Cache::MODE_NORMAL);
     $queryCache = $this->_em->getCache()->getQueryCache($this->cacheRegion);
     $result = $queryCache->get($querykey, $rsm, $this->_hints);
     if ($result !== null) {
         if ($this->cacheLogger) {
             $this->cacheLogger->queryCacheHit($queryCache->getRegion()->getName(), $querykey);
         }
         return $result;
     }
     $result = $this->executeIgnoreQueryCache($parameters, $hydrationMode);
     $cached = $queryCache->put($querykey, $rsm, $result, $this->_hints);
     if ($this->cacheLogger) {
         $this->cacheLogger->queryCacheMiss($queryCache->getRegion()->getName(), $querykey);
         if ($cached) {
             $this->cacheLogger->queryCachePut($queryCache->getRegion()->getName(), $querykey);
         }
     }
     return $result;
 }
开发者ID:AlexanderForks,项目名称:doctrine2,代码行数:30,代码来源:AbstractQuery.php

示例2: __construct

 /**
  * @param \Doctrine\ORM\Persisters\Entity\EntityPersister $persister The entity persister to cache.
  * @param \Doctrine\ORM\Cache\Region                      $region    The entity cache region.
  * @param \Doctrine\ORM\EntityManagerInterface            $em        The entity manager.
  * @param \Doctrine\ORM\Mapping\ClassMetadata             $class     The entity metadata.
  */
 public function __construct(EntityPersister $persister, Region $region, EntityManagerInterface $em, ClassMetadata $class)
 {
     $configuration = $em->getConfiguration();
     $cacheConfig = $configuration->getSecondLevelCacheConfiguration();
     $cacheFactory = $cacheConfig->getCacheFactory();
     $this->class = $class;
     $this->region = $region;
     $this->persister = $persister;
     $this->cache = $em->getCache();
     $this->regionName = $region->getName();
     $this->uow = $em->getUnitOfWork();
     $this->metadataFactory = $em->getMetadataFactory();
     $this->cacheLogger = $cacheConfig->getCacheLogger();
     $this->timestampRegion = $cacheFactory->getTimestampRegion();
     $this->hydrator = $cacheFactory->buildEntityHydrator($em, $class);
     $this->timestampKey = new TimestampCacheKey($this->class->getTableName());
 }
开发者ID:BusinessCookies,项目名称:CoffeeMachineProject,代码行数:23,代码来源:AbstractEntityPersister.php

示例3: getCache

 /**
  * {@inheritdoc}
  */
 public function getCache()
 {
     return $this->wrapped->getCache();
 }
开发者ID:Dren-x,项目名称:mobitnew,代码行数:7,代码来源:EntityManagerDecorator.php


注:本文中的Doctrine\ORM\EntityManagerInterface::getCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。