Skip to main content

Enable Caching

Please follow the steps for Enabling Caching in production instances

Enabling Cache in Auth Manager​

Go to Web.php in Application config and update authManager class with Cache

'authManager' => [
'class' => 'uims\user\modules\jiuser\components\rbac\DbManager',
'cache'=>'cache' // Use in production
],

Enabling DB Cache​

In all DB Connection Files in Application Config enable caching by appending below statements

'enableSchemaCache' => true,
// Duration of schema cache.
'schemaCacheDuration' => 3600,
// Name of the cache component used to store schema information
'schemaCache' => 'cache',

Note: Also enable Slave configuration in DB

Enable Cache in Long query in all samarth modules​

Define Cache Constant in Web.php in Application config

defined('SAM_DB_CACHE') or define('SAM_DB_CACHE', 3600);

Use in Active query by appending below code to your Active Query.

->cache(SAM_DB_CACHE)