Reputation: 1689
I am trying to figure out where to setup my memcached configuration in CakePHP 2. Both core.php and bootstrap.php have sections to set up any cache such as memcached, but I still haven't figured out which file to use.
Also the CakePHP documentation is not so clear about this in my eyes. Could anyone point out what part of the memcached configuration goes into which file please.
Upvotes: 0
Views: 396
Reputation: 427
Really, you can place configuration values anywhere you would like, even in their own files as long as you load them in core.php
or bootstrap.php
. However, the default 2.0 core.php
file states that other cache configurations should be in bootstrap.php
as stated here: https://github.com/cakephp/cakephp/blob/master/app/Config/core.php#L349.
FWIW, we load addition configuration files depending on an environment variable (APP_ENV
) as well as a location specific one that overrides all others. We call it core-local.php
but the name doesn't really matter as long as it's not tracked in your VCS.
Edit:
Here's how we load environment specific configs. This is towards the end of our core.php
so that the configs loaded after it are not overwritten.
$env = getenv('APP_ENV');
if (is_readable(dirname(__FILE__) . "/core-{$env}.php")) {
Configure::load("core-{$env}");
}
End Edit
Lastly, the CakePHP docs are really easy to edit and PRs are very welcome. If you think you can clarify the docs just click on the link at the top of the documentation page and edit away. You can then use the GitHub UI to submit the PR. No editor or git binary is necessary.
Upvotes: 3