I am working on a project in cakephp where one app will support multiple sites using different domains. This is an issue when using view caching where it only matches to the end part of the url and ignores the host.
Is there a way to prefix view caching with the host so that there isn't any conflict across different s开发者_如何学Goites?
You can use a different cache configuration for each domain, like this:
app/config/core.php
switch(@$_SERVER['SERVER_NAME']) {
case 'example.com':
Cache::config('default', array(
'engine' => 'File',
'prefix' => 'example_com_'
));
break;
case 'example2.com':
Cache::config('default', array(
'engine' => 'File',
'prefix' => 'example2_com_'
));
break;
default:
Cache::config('default', array(
'engine' => 'File',
'prefix' => 'default_'
));
break;
}
精彩评论