Back to Cache class

Method __construct

public
__construct
(mixed $options)
Constructor
Parameters
  • array $options Cache options
Since
  • 1.7.0
Class: Cache
Project: Joomla

Method __construct - Source code

/**
 * Constructor
 *
 * @param   array  $options  Cache options
 *
 * @since   1.7.0
 */
public function __construct($options)
{
    $app = Factory::getApplication();
    $this->_options = array('cachebase' => $app->get('cache_path', JPATH_CACHE), 'lifetime' => (int) $app->get('cachetime'), 'language' => $app->get('language', 'en-GB'), 'storage' => $app->get('cache_handler', ''), 'defaultgroup' => 'default', 'locking' => true, 'locktime' => 15, 'checkTime' => true, 'caching' => $app->get('caching') >= 1);
    // Overwrite default options with given options
    foreach ($options as $option => $value) {
        if (isset($options[$option]) && $options[$option] !== '') {
            $this->_options[$option] = $options[$option];
        }
    }
    if (empty($this->_options['storage'])) {
        $this->setCaching(false);
    }
}