Doctrine\DBAL\Cache\ResultCacheStatement
Cache statement for SQL results.
A result is saved in multiple cache keys, there is the originally specified
cache key which is just pointing to result rows by key. The following things
have to be ensured:
1. lifetime of the original key has to be longer than that of all the individual rows keys
2. if any one row key is missing the query has to be re-executed.
Also you have to realize that the cache will load the whole result into memory at once to ensure 2.
This means that the memory usage for cached results might increase by using this feature.
Synopsis
class ResultCacheStatement
implements
IteratorAggregate,ResultStatement
{
- // members
- private Cache $resultCache;
- private string $cacheKey;
- private string $realKey;
- private int $lifetime;
- private Statement $statement;
- private bool $emptied;
- private array $data;
- private int $defaultFetchMode;
- // methods
- public void __construct()
- public boolean closeCursor()
- public integer columnCount()
- public void setFetchMode()
- public void getIterator()
- public mixed fetch()
- public array fetchAll()
- public string fetchColumn()
- public integer rowCount()
Hierarchy
Tasks
Line | Task |
---|---|
217 | verify this is correct behavior |
Members
private
- $cacheKey — string
- $data — array
- $defaultFetchMode — int
- $emptied
—
Doctrine\DBAL\Cache\bool
Did we reach the end of the statement? - $lifetime — int
- $realKey — string
- $resultCache — \Doctrine\Common\Cache\Cache
- $statement — Doctrine\DBAL\Cache\Doctrine\DBAL\Driver\Statement
Methods
public
- __construct()
- closeCursor() — Closes the cursor, enabling the statement to be executed again.
- columnCount() — columnCount Returns the number of columns in the result set
- fetch() — fetch
- fetchAll() — Returns an array containing all of the result set rows
- fetchColumn() — fetchColumn Returns a single column from the next row of a result set or FALSE if there are no more rows.
- getIterator()
- rowCount() — rowCount rowCount() returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement executed by the corresponding object.
- setFetchMode()