Interface for DAO objects providing chunked access.
More...
|
| findEntryPosition ( $key) |
| Finds the position for the given key in the internal entry array. More...
|
|
| insertChunk ( $start, $size, $before) |
|
| prune () |
| Removes least recently used chunks until the total size is smaller than the max size specified in the constructor. More...
|
|
Interface for DAO objects providing chunked access.
- Copyright
- GPL-2.0-or-later
- Author
- Daniel Kinzler
◆ __construct()
Wikibase\Lib\Store\ChunkCache::__construct |
( |
ChunkAccess |
$source, |
|
|
|
$chunkSize, |
|
|
|
$maxSize |
|
) |
| |
- Parameters
-
ChunkAccess | $source | The source to load from |
int | $chunkSize | The size of the chunk to load, if we have a choice |
int | $maxSize | The maximum size this cache can grow to |
- Exceptions
-
◆ findEntryPosition()
Wikibase\Lib\Store\ChunkCache::findEntryPosition |
( |
|
$key | ) |
|
|
private |
Finds the position for the given key in the internal entry array.
This is implemented using iterative binary search.
- Parameters
-
- Returns
- int the position if found, or the negative insert position minus one, if not.
◆ getRecordId()
Wikibase\Lib\Store\ChunkCache::getRecordId |
( |
|
$rec | ) |
|
◆ insertChunk()
Wikibase\Lib\Store\ChunkCache::insertChunk |
( |
|
$start, |
|
|
|
$size, |
|
|
|
$before |
|
) |
| |
|
private |
- Parameters
-
int | $start | the ID to start loading at |
int | $size | the maximum size of the chunk to load |
int | $before | insert into the internal entry list before this position. |
- Exceptions
-
- Returns
- array|bool the cache entry created by inserting the new chunk, or false if there is no more data to load from the source at the given position. The cache entry is an associative array containing the following keys:
- start: the key the chunk starts at
- data: a list of data records
- next: the id the following chunk starts at (or after)
- touched: (logical) timestamp of the entry's creation (taken from $this->modCount)
◆ loadChunk()
Wikibase\Lib\Store\ChunkCache::loadChunk |
( |
|
$start, |
|
|
|
$size |
|
) |
| |
Returns a chunk as a list of whatever object is used for data records by the implementing class.
- Parameters
-
int | $start | The first ID in the chunk |
int | $size | The desired size of the chunk |
- Returns
- array the desired chunk of rows/objects
Implements Wikibase\Lib\Store\ChunkAccess.
◆ prune()
Wikibase\Lib\Store\ChunkCache::prune |
( |
| ) |
|
|
private |
Removes least recently used chunks until the total size is smaller than the max size specified in the constructor.
◆ $chunkSize
Wikibase\Lib\Store\ChunkCache::$chunkSize |
|
private |
◆ $entries
Wikibase\Lib\Store\ChunkCache::$entries = [] |
|
private |
◆ $hitCount
Wikibase\Lib\Store\ChunkCache::$hitCount = 0 |
|
private |
◆ $maxSize
Wikibase\Lib\Store\ChunkCache::$maxSize |
|
private |
◆ $missCount
Wikibase\Lib\Store\ChunkCache::$missCount = 0 |
|
private |
◆ $modCount
Wikibase\Lib\Store\ChunkCache::$modCount = 0 |
|
private |
◆ $size
Wikibase\Lib\Store\ChunkCache::$size = 0 |
|
private |
◆ $source
Wikibase\Lib\Store\ChunkCache::$source |
|
private |
The documentation for this class was generated from the following file: