protected function _getCacheOptions($cacheOptions)
{
$_cacheOptions = is_array($cacheOptions) ? $cacheOptions : ['ttl' => $cacheOptions];
if (isset($this->_models[0]) && count($this->_models) === 1) {
$modelName = $this->_models[0];
$prefix = '/' . $this->dispatcher->getModuleName() . '/Models/' . substr($modelName, strrpos($modelName, '\\') + 1);
} else {
$prefix = '/' . $this->dispatcher->getModuleName() . '/Queries/' . $this->dispatcher->getControllerName();
}
if (isset($_cacheOptions['key'])) {
if ($_cacheOptions['key'][0] === '/') {
throw new QueryBuilderException('modelsCache `:key` key can not be start with `/`', ['key' => $_cacheOptions['key']]);
}
$_cacheOptions['key'] = $prefix . '/' . $_cacheOptions['key'];
} else {
$_cacheOptions['key'] = $prefix . '/' . md5($this->_sql . serialize($this->_bind));
}
return $_cacheOptions;
}