public set ( string $entryIdentifier, string $sourceCode, array $tags = [], integer $lifetime = null ) : void | ||
$entryIdentifier | string | An identifier used for this cache entry, for example the class name |
$sourceCode | string | PHP source code |
$tags | array | Tags to associate with this cache entry |
$lifetime | integer | Lifetime of this cache entry in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited lifetime. |
return | void |
public function set($entryIdentifier, $sourceCode, array $tags = [], $lifetime = null)
{
if (!$this->isValidEntryIdentifier($entryIdentifier)) {
throw new \InvalidArgumentException('"' . $entryIdentifier . '" is not a valid cache entry identifier.', 1264023823);
}
if (!is_string($sourceCode)) {
throw new InvalidDataException('The given source code is not a valid string.', 1264023824);
}
foreach ($tags as $tag) {
if (!$this->isValidTag($tag)) {
throw new \InvalidArgumentException('"' . $tag . '" is not a valid tag for a cache entry.', 1264023825);
}
}
$sourceCode = '<?php ' . $sourceCode . chr(10) . '#';
$this->backend->set($entryIdentifier, $sourceCode, $tags, $lifetime);
}
/** * Shutdown the Evaluator and save created expressions overwriting any existing expressions * * @return void */ public function saveRuntimeExpressions() { if ($this->newExpressions === []) { return; } $codeToBeCached = 'return array (' . chr(10); foreach ($this->newExpressions as $name => $function) { $codeToBeCached .= "'" . $name . "' => " . $function . ',' . chr(10); } $codeToBeCached .= ');'; $this->runtimeExpressionsCache->set('Flow_Aop_RuntimeExpressions', $codeToBeCached); }