mongodb\Cache gc()

gc() public method Removes the expired data values. public void gc ( $force = false )$force boolean Whether to enforce the garbage collection regardless of $gcProbability. Defaults to false, meaning the actual deletion happens with the probability as specified by $gcProbability.

mongodb\Cache deleteValue()

deleteValue() protected method Deletes a value with the specified key from cache This method should be implemented by child classes to delete the data from actual cache storage. protected boolean deleteValue ( $key )$key string The key of the value to be deleted return boolean If no error happens during deletion

mongodb\Cache getValue()

getValue() protected method Retrieves a value from cache with a specified key. This method should be implemented by child classes to retrieve the data from specific cache storage. protected string|boolean getValue ( $key )$key string A unique key identifying the cached value return string|boolean The value stored in cache, false if the value is not in the cache or expired.

mongodb\Cache $cacheCollection

$cacheCollection public property The name of the MongoDB collection that stores the cache data. Please refer to yii\mongodb\Connection::getCollection() on how to specify this parameter. This collection is better to be pre-created with fields 'id' and 'expire' indexed. public string|array $cacheCollection = 'cache'

mongodb\Cache addValue()

addValue() protected method Stores a value identified by a key into cache if the cache does not contain this key. This method should be implemented by child classes to store the data in specific cache storage. protected boolean addValue ( $key, $value, $expire )$key string The key identifying the value to be cached $value string The value to be cached $expire integer The number of seconds in which the cached value will expire. 0 means never expire. return boolean True if the value

mongodb\Cache $gcProbability

$gcProbability public property The probability (parts per million) that garbage collection (GC) should be performed when storing a piece of data in the cache. Defaults to 100, meaning 0.01% chance. This number should be between 0 and 1000000. A value 0 meaning no GC will be performed at all. public integer $gcProbability = 100

mongodb\Cache $db

$db public property The MongoDB connection object or the application component ID of the MongoDB connection. After the Cache object is created, if you want to change this property, you should only assign it with a MongoDB connection object. Starting from version 2.0.2, this can also be a configuration array for creating the object. public yii\mongodb\Connection|array|string $db = 'mongodb'

mongodb\BatchQueryResult key()

key() public method Returns the index of the current dataset. This method is required by the interface Iterator. public integer key ( )return integer The index of the current row.

mongodb\BatchQueryResult next()

next() public method Moves the internal pointer to the next dataset. This method is required by the interface Iterator. public void next ( )

mongodb\BatchQueryResult valid()

valid() public method Returns whether there is a valid dataset at the current position. This method is required by the interface Iterator. public boolean valid ( )return boolean Whether there is a valid dataset at the current position.