Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
Cache Class Reference
Inheritance diagram for Cache:
CacheInterface Cache

Public Member Functions

 __construct (\Magento\Framework\App\Cache\Frontend\Pool $frontendPool)
 
 getFrontend ()
 
 load ($identifier)
 
 save ($data, $identifier, $tags=[], $lifeTime=null)
 
 remove ($identifier)
 
- Public Member Functions inherited from CacheInterface
 clean ($tags=[])
 

Protected Attributes

 $_frontendIdentifier = \Magento\Framework\App\Cache\Frontend\Pool::DEFAULT_FRONTEND_ID
 
 $_frontendPool
 
 $_frontend
 

Detailed Description

Definition at line 13 of file Cache.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Framework\App\Cache\Frontend\Pool  $frontendPool)
Parameters
\Magento\Framework\App\Cache\Frontend\Pool$frontendPool

Definition at line 35 of file Cache.php.

36  {
37  $this->_frontendPool = $frontendPool;
38  $this->_frontend = $frontendPool->get($this->_frontendIdentifier);
39  }

Member Function Documentation

◆ getFrontend()

getFrontend ( )

Get cache frontend API object

Returns
\Magento\Framework\Cache\FrontendInterface

Implements CacheInterface.

Definition at line 46 of file Cache.php.

47  {
48  return $this->_frontend;
49  }

◆ load()

load (   $identifier)

Load data from cache by id

Parameters
string$identifier
Returns
string

Implements CacheInterface.

Definition at line 57 of file Cache.php.

58  {
59  return $this->_frontend->load($identifier);
60  }

◆ remove()

remove (   $identifier)

Remove cached data by identifier

Parameters
string$identifier
Returns
bool

Implements CacheInterface.

Definition at line 82 of file Cache.php.

83  {
84  return $this->_frontend->remove($identifier);
85  }

◆ save()

save (   $data,
  $identifier,
  $tags = [],
  $lifeTime = null 
)

Save data

Parameters
string$data
string$identifier
array$tags
int$lifeTime
Returns
bool

Implements CacheInterface.

Definition at line 71 of file Cache.php.

72  {
73  return $this->_frontend->save((string)$data, $identifier, $tags, $lifeTime);
74  }

Field Documentation

◆ $_frontend

$_frontend
protected

Definition at line 30 of file Cache.php.

◆ $_frontendIdentifier

Definition at line 18 of file Cache.php.

◆ $_frontendPool

$_frontendPool
protected

Definition at line 23 of file Cache.php.


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