TYPO3 CMS  TYPO3_6-2
StringFrontend.php
Go to the documentation of this file.
1 <?php
3 
25 
38  public function set($entryIdentifier, $string, array $tags = array(), $lifetime = NULL) {
39  if (!$this->isValidEntryIdentifier($entryIdentifier)) {
40  throw new \InvalidArgumentException('"' . $entryIdentifier . '" is not a valid cache entry identifier.', 1233057566);
41  }
42  if (!is_string($string)) {
43  throw new \TYPO3\CMS\Core\Cache\Exception\InvalidDataException('Given data is of type "' . gettype($string) . '", but a string is expected for string cache.', 1222808333);
44  }
45  foreach ($tags as $tag) {
46  if (!$this->isValidTag($tag)) {
47  throw new \InvalidArgumentException('"' . $tag . '" is not a valid tag for a cache entry.', 1233057512);
48  }
49  }
50  $this->backend->set($entryIdentifier, $string, $tags, $lifetime);
51  }
52 
61  public function get($entryIdentifier) {
62  if (!$this->isValidEntryIdentifier($entryIdentifier)) {
63  throw new \InvalidArgumentException('"' . $entryIdentifier . '" is not a valid cache entry identifier.', 1233057752);
64  }
65  return $this->backend->get($entryIdentifier);
66  }
67 
76  public function getByTag($tag) {
77  if (!$this->isValidTag($tag)) {
78  throw new \InvalidArgumentException('"' . $tag . '" is not a valid tag for a cache entry.', 1233057772);
79  }
80  $entries = array();
81  $identifiers = $this->backend->findIdentifiersByTag($tag);
82  foreach ($identifiers as $identifier) {
83  $entries[] = $this->backend->get($identifier);
84  }
85  return $entries;
86  }
87 
88 }