Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields
Cache Class Reference

Public Member Functions

 __construct (Cli $cli)
 
 flush (array $cacheTypes=[])
 
 disableCache ($cacheType=null)
 
 enableCache ($cacheType=null)
 

Data Fields

const PARAM_CACHE_FLUSH = 'cache:flush'
 
const PARAM_CACHE_DISABLE = 'cache:disable'
 
const PARAM_CACHE_ENABLE = 'cache:enable'
 

Detailed Description

Handle cache for tests executions.

Definition at line 14 of file Cache.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( Cli  $cli)

Cache constructor.

Parameters
Cli$cli

Definition at line 27 of file Cache.php.

28  {
29  $this->cli = $cli;
30  }

Member Function Documentation

◆ disableCache()

disableCache (   $cacheType = null)

Disable all cache or one cache type.

Parameters
string$cacheType[optional]
Returns
void

Definition at line 66 of file Cache.php.

67  {
68  $this->cli->execute(Cache::PARAM_CACHE_DISABLE . ($cacheType ? " $cacheType" : ''));
69  }

◆ enableCache()

enableCache (   $cacheType = null)

Enable all cache or one cache type.

Parameters
string$cacheType[optional]
Returns
void

Definition at line 77 of file Cache.php.

78  {
79  $this->cli->execute(Cache::PARAM_CACHE_ENABLE . ($cacheType ? " $cacheType" : ''));
80  }

◆ flush()

flush ( array  $cacheTypes = [])

Flush Cache. If no parameters are set, all cache types are flushed.

Parameters
array$cacheTypes
Returns
void

Definition at line 54 of file Cache.php.

55  {
56  $options = empty($cacheTypes) ? '' : ' ' . implode(' ', $cacheTypes);
57  $this->cli->execute(Cache::PARAM_CACHE_FLUSH . $options);
58  }

Field Documentation

◆ PARAM_CACHE_DISABLE

const PARAM_CACHE_DISABLE = 'cache:disable'

Parameter for cache disable command.

Definition at line 40 of file Cache.php.

◆ PARAM_CACHE_ENABLE

const PARAM_CACHE_ENABLE = 'cache:enable'

Parameter for cache enable command.

Definition at line 45 of file Cache.php.

◆ PARAM_CACHE_FLUSH

const PARAM_CACHE_FLUSH = 'cache:flush'

Parameter for flush cache command.

Definition at line 35 of file Cache.php.


The documentation for this class was generated from the following file: