Caching¶
Generated solutions can be cached if the solution provider in
use is cacheable (see EliasHaeussler\Typo3Solver\ProblemSolving\Solution\Provider\SolutionProvider::isCacheable
).
For this, a filesystem-based solution cache is implemented. In
addition, an exception cache is provided which stores exceptions
when solution streaming is active.
Note
All caches are low-level caches and cannot be configured.
- class EliasHaeussler\Typo3Solver\Cache\ExceptionsCache¶
Low-level cache manager for exceptions. This class is only used in combination with solution streaming.
Note
This cache writes to
var/cache/data/tx_solver/exceptions.php
.- get($entryIdentifier)¶
Get exception by cache identifier. If no cache with the given identifier exists,
null
is returned.- Parameters
$entryIdentifier (
string
) -- Cache identifier of the exception to look up
- Return type
Throwable|null
- getIdentifier($exception)¶
Get calculated exception identifier of the given exception.
- Parameters
$exception (
Throwable
) -- Exception to calculate a cache identifier
- Return type
string
- set($exception)¶
Add the given exception to the exceptions cache and return the associated cache identifier.
- Parameters
$exception (
Throwable
) -- The exception to be cached
- Return type
string
- flush()¶
Remove all cached exceptions.
- class EliasHaeussler\Typo3Solver\Cache\SolutionsCache¶
Low-level cache manager for solutions. This class is used in combination with
EliasHaeussler\Typo3Solver\ProblemSolving\Solution\Provider\CacheSolutionProvider
.Note
This cache writes to
var/cache/data/tx_solver/solutions.php
.- get($problem)¶
Get cached solution for the given problem. If no solution exists in cache,
null
is returned.- Parameters
$problem (
EliasHaeussler\Typo3Solver\ProblemSolving\Problem\Problem
) -- Problem to get a cached solution for
- Return type
EliasHaeussler\Typo3Solver\ProblemSolving\Solution\Solution|null
- set($problem, $solution)¶
Add the given solution to the solutions cache and use the given problem to generate the cache identifier.
- Parameters
$problem (
EliasHaeussler\Typo3Solver\ProblemSolving\Problem\Problem
) -- The problem of the solution to be cached$solution (
EliasHaeussler\Typo3Solver\ProblemSolving\Solution\Solution
) -- The solution to be cached
- flush()¶
Remove all cached solutions.