cakephp-2.0 > Cache :: config()
A AbstractTransport AclBehavior AclComponent AclInterface AclNode AclShell Aco AcoAction ActionsAuthorize ApcEngine ApiShell App AppController AppController AppHelper AppHelper AppModel AppModel AppShell Aro AuthComponent B BadRequestException BakeShell BakeTask BaseAuthenticate BaseAuthorize BasicAuthenticate BasicAuthentication BehaviorCollection C Cache CacheEngine CacheException CacheHelper CacheSession CakeEmail CakeErrorController CakeException CakeLog CakeLogException CakeLogInterface CakePlugin CakeRequest CakeResponse CakeRoute CakeSchema CakeSession CakeSessionException CakeSessionHandlerInterface CakeSocket ClassRegistry CommandListShell Component ComponentCollection ConfigReaderInterface Configure ConfigureException ConnectionManager ConsoleErrorHandler ConsoleException ConsoleInput ConsoleInputArgument ConsoleInputOption ConsoleInputSubcommand ConsoleOptionParser ConsoleOutput ConsoleShell ContainableBehavior Controller ControllerAuthorize ControllerTask CookieComponent CrudAuthorize D DatabaseSession DataSource DbAcl DbAclSchema DbConfigTask DboSource Debugger DebugTransport DigestAuthenticate DigestAuthentication Dispatcher E EmailComponent ErrorHandler ExceptionRenderer ExtractTask F File FileEngine FileLog FixtureTask Folder ForbiddenException FormAuthenticate FormHelper H Helper HelperCollection HelpFormatter HtmlHelper HttpException HttpResponse HttpSocket I I18n I18nModel i18nSchema I18nShell Inflector IniReader InternalErrorException J JqueryEngineHelper JsBaseEngineHelper JsHelper L L10n M MailTransport MediaView MemcacheEngine MethodNotAllowedException MissingActionException MissingBehaviorException MissingComponentException MissingConnectionException MissingControllerException MissingDatabaseException MissingDatasourceConfigException MissingDatasourceException MissingHelperException MissingLayoutException MissingModelException MissingPluginException MissingShellException MissingShellMethodException MissingTableException MissingTaskException MissingTestLoaderException MissingViewException Model ModelBehavior ModelTask MootoolsEngineHelper Multibyte Mysql N NotFoundException NumberHelper O Object ObjectCollection P PagesController PagesController PaginatorComponent PaginatorHelper Permission PhpReader PluginShortRoute PluginTask Postgres PrivateActionException ProjectTask PrototypeEngineHelper R RedirectRoute RequestHandlerComponent Router RouterException RssHelper S Sanitize Scaffold ScaffoldView SchemaShell Security SecurityComponent SessionComponent SessionHelper SessionsSchema Set Shell ShellDispatcher SmtpTransport SocketException Sqlite Sqlserver String T TaskCollection TemplateTask TestsuiteShell TestTask TextHelper ThemeView TimeHelper TranslateBehavior TreeBehavior U UnauthorizedException UpgradeShell V Validation View ViewTask W WincacheEngine X XcacheEngine Xml XmlException

config

line:116 at /lib/Cake/Cache/Cache.php
Set the cache configuration to use. config() can both create new configurations, return the settings for already configured configurations.

Method

(array(engine,) public config ($name = null, $settings = array())

Parameters

ParameterTypeCommentDefault
$name string optional Name of the configuration null
$settings array optional Optional associative array of settings passed to the engine array()

Return

array(engine,

Comment

Set the cache configuration to use. config() can
both create new configurations, return the settings for already configured
configurations.

To create a new configuration, or to modify an existing configuration permanently:

`Cache::config('my_config', array('engine' => 'File', 'path' => TMP));`

If you need to modify a configuration temporarily, use Cache::set().
To get the settings for a configuration:

`Cache::config('default');`

There are 5 built-in caching engines:

- `FileEngine` - Uses simple files to store content. Poor performance, but good for
storing large objects, or things that are not IO sensitive.
- `ApcEngine` - Uses the APC object cache, one of the fastest caching engines.
- `MemcacheEngine` - Uses the PECL::Memcache extension and Memcached for storage.
Fast reads/writes, and benefits from memcache being distributed.
- `XcacheEngine` - Uses the Xcache extension, an alternative to APC.
- `WincacheEngine` - Uses Windows Cache Extension for PHP. Supports wincache 1.1.0 and higher.

The following keys are used in core cache engines:

- `duration` Specify how long items in this cache configuration last.
- `prefix` Prefix appended to all entries. Good for when you need to share a keyspace
with either another cache config or another application.
- `probability` Probability of hitting a cache gc cleanup. Setting to 0 will disable
cache::gc from ever being called automatically.
- `servers' Used by memcache. Give the address of the memcached servers to use.
- `compress` Used by memcache. Enables memcache's compressed format.
- `serialize` Used by FileCache. Should cache objects be serialized first.
- `path` Used by FileCache. Path to where cachefiles should be saved.
- `lock` Used by FileCache. Should files be locked before writing to them?
- `user` Used by Xcache. Username for XCache
- `password` Used by Xcache. Password for XCache

@see app/Config/core.php for configuration settings
@param string $name Name of the configuration
@param array $settings Optional associative array of settings passed to the engine
@return array(engine, settings) on success, false on failure
@throws CacheException