Back to Cache class

Method getInstance

public static \Joomla\CMS\Cache\CacheController
getInstance
(mixed $type = 'output', mixed $options = array())
Returns a reference to a cache adapter object, always creating it
Parameters
  • string $type The cache object type to instantiate
  • array $options The array of options
Returns
  • \Joomla\CMS\Cache\CacheController
Since
  • 1.7.0
Deprecated
  • 5.0
Class: Cache
Project: Joomla

Method getInstance - Source code

/**
 * Returns a reference to a cache adapter object, always creating it
 *
 * @param   string  $type     The cache object type to instantiate
 * @param   array   $options  The array of options
 *
 * @return  CacheController
 *
 * @since       1.7.0
 * @deprecated  5.0 Use the cache controller factory instead
 */
public static function getInstance($type = 'output', $options = array())
{
    @trigger_error(sprintf('%s() is deprecated. The cache controller should be fetched from the factory.', __METHOD__), E_USER_DEPRECATED);
    return Factory::getContainer()->get(CacheControllerFactoryInterface::class)->createCacheController($type, $options);
}