TYPO3 CMS  TYPO3_6-2
AbstractFrontend.php
Go to the documentation of this file.
1 <?php
3 
26 
32  protected $identifier;
33 
37  protected $backend;
38 
46  public function __construct($identifier, \TYPO3\CMS\Core\Cache\Backend\BackendInterface $backend) {
47  if (preg_match(self::PATTERN_ENTRYIDENTIFIER, $identifier) !== 1) {
48  throw new \InvalidArgumentException('"' . $identifier . '" is not a valid cache identifier.', 1203584729);
49  }
50  $this->identifier = $identifier;
51  $this->backend = $backend;
52  $this->backend->setCache($this);
53  }
54 
61  public function getIdentifier() {
62  return $this->identifier;
63  }
64 
71  public function getBackend() {
72  return $this->backend;
73  }
74 
83  public function has($entryIdentifier) {
84  if (!$this->isValidEntryIdentifier($entryIdentifier)) {
85  throw new \InvalidArgumentException('"' . $entryIdentifier . '" is not a valid cache entry identifier.', 1233058486);
86  }
87  return $this->backend->has($entryIdentifier);
88  }
89 
98  public function remove($entryIdentifier) {
99  if (!$this->isValidEntryIdentifier($entryIdentifier)) {
100  throw new \InvalidArgumentException('"' . $entryIdentifier . '" is not a valid cache entry identifier.', 1233058495);
101  }
102  return $this->backend->remove($entryIdentifier);
103  }
104 
111  public function flush() {
112  $this->backend->flush();
113  }
114 
123  public function flushByTag($tag) {
124  if (!$this->isValidTag($tag)) {
125  throw new \InvalidArgumentException('"' . $tag . '" is not a valid tag for a cache entry.', 1233057359);
126  }
127  if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/cache/frontend/class.t3lib_cache_frontend_abstractfrontend.php']['flushByTag'])) {
128  foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/cache/frontend/class.t3lib_cache_frontend_abstractfrontend.php']['flushByTag'] as $_funcRef) {
129  $params = array('tag' => $tag);
131  }
132  }
133  if ($this->backend instanceof \TYPO3\CMS\Core\Cache\Backend\TaggableBackendInterface) {
134  $this->backend->flushByTag($tag);
135  }
136  }
137 
144  public function collectGarbage() {
145  $this->backend->collectGarbage();
146  }
147 
156  return preg_match(self::PATTERN_ENTRYIDENTIFIER, $identifier) === 1;
157  }
158 
166  public function isValidTag($tag) {
167  return preg_match(self::PATTERN_TAG, $tag) === 1;
168  }
169 
170 }
static callUserFunction($funcName, &$params, &$ref, $checkPrefix='', $errorMode=0)
__construct($identifier, \TYPO3\CMS\Core\Cache\Backend\BackendInterface $backend)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]