views:

103

answers:

1

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 sites?

A: 

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;
}
Marko
I already have a setup where the prefix is the domain making it unlimitedly scaleable but the view cache doesn't seem to be using the standard configs..
Shard