By default, Cache stores session data in a MongoDB collection named 'cache' inside the default database.
This collection is better to be pre-created with fields 'id' and 'expire' indexed.
The collection name can be changed by setting [[cacheCollection]].
Please refer to Cache for common cache operations that are supported by Cache.
The following example shows how you can configure the application to use Cache:
php
'cache' => [
'class' => 'yii\mongodb\Cache',
'db' => 'mymongodb',
'cacheCollection' => 'my_cache',
]