"Fossies" - the Fresh Open Source Software Archive

Member "papayacms-core-6.12.5/src/system/Papaya/Plugin/Cacheable/Aggregation.php" (7 Jul 2020, 1574 Bytes) of package /linux/www/papayacms-core-6.12.5.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "Aggregation.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 /**
    3  * papaya CMS
    4  *
    5  * @copyright 2000-2018 by papayaCMS project - All rights reserved.
    6  * @link http://www.papaya-cms.com/
    7  * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License, version 2
    8  *
    9  *  You can redistribute and/or modify this script under the terms of the GNU General Public
   10  *  License (GPL) version 2, provided that the copyright and license notes, including these
   11  *  lines, remain unmodified. papaya is distributed in the hope that it will be useful, but
   12  *  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   13  *  FOR A PARTICULAR PURPOSE.
   14  */
   15 namespace Papaya\Plugin\Cacheable;
   16 
   17 use Papaya\Cache;
   18 
   19 /**
   20  * Define the plugin output as cacheable. A cache definition allows to get
   21  * the cache values, but also the sources the are from.
   22  *
   23  * @package Papaya-Library
   24  * @subpackage Plugins
   25  */
   26 trait Aggregation {
   27   /**
   28    * @var Cache\Identifier\Definition
   29    */
   30   private $_cacheDefinition;
   31 
   32   /**
   33    * Provide the cache definition for the output.
   34    *
   35    * @param Cache\Identifier\Definition $definition
   36    *
   37    * @return Cache\Identifier\Definition
   38    */
   39   public function cacheable(Cache\Identifier\Definition $definition = NULL) {
   40     if (NULL !== $definition) {
   41       $this->_cacheDefinition = $definition;
   42     } elseif (NULL === $this->_cacheDefinition) {
   43       $this->_cacheDefinition = $this->createCacheDefinition();
   44     }
   45     return $this->_cacheDefinition;
   46   }
   47 
   48   /**
   49    * @return Cache\Identifier\Definition
   50    */
   51   abstract public function createCacheDefinition();
   52 }