The results from a query Mapped Statement can be cached simply by specifying the {@link CacheModel TSqlMapStatement::setCacheModel()} property in tag. A cache model is a configured cache that is defined within the sql map configuration file. Cache models are configured using the element. The cache model uses a pluggable framework for supporting different types of caches. The choice of cache is specified by the {@link Implementation setImplementation()} property. The class name specified must be one of {@link TSqlMapCacheTypes}. The cache implementations, LRU and FIFO cache below do not persist across requests. That is, once the request is complete, all cache data is lost. These caches are useful queries that results in the same repeated data during the current request.
С версии: 3.1
Наследование: extends Prado\TComponent
Пример #1
0
 /**
  * Adds a named cache.
  * @param TSqlMapCacheModel the cache to add.
  * @throws TSqlMapConfigurationException
  */
 public function addCacheModel(TSqlMapCacheModel $cacheModel)
 {
     if ($this->_cacheModels->contains($cacheModel->getID())) {
         throw new TSqlMapConfigurationException('sqlmap_cache_model_already_exists', $cacheModel->getID());
     } else {
         $this->_cacheModels->add($cacheModel->getID(), $cacheModel);
     }
 }