Configuration

Configuration

The following extended configuration is completely optional. This will allow you to change the default settings for the CE Cache add-on directly from your config.php file.

Note: You don’t need to add any of these settings. Use only as needed.

Simply copy what you need from the following code and paste it near the bottom of your system/user/config/config.php file.

Settings specified in the config can be overwritten by the global array (which takes a higher precedence), or the tag parameters (highest precedence). You can use one or more of these settings as defaults for all of your sites.

/*
|-----------------------
| CE Cache Config Items
|-----------------------
|
| The following items are for use with CE Cache. They are all optional.
*/

/*
| The driver(s) to use. You can specify on or more of the following: 'file',
| 'sqlite', 'db', 'apc', 'redis', 'memcache', 'memcached', or 'dummy'. APC,
| Redis, Memcache, and/or Memcached must be installed and configured on your
| server before they can be used. The default driver setting (if not
| specified), is 'file'. If you want to specify multiple drivers, simply
| separate them with a pipe (|) character, and if a driver method call
| fails, it will fallback to the next driver down the line and try again.
*/

$config['ce_cache_drivers'] = 'file|db';

/*
| The default number of seconds to cache items. Defaults to 3600 (1 hour).
| If you set this to '0', your cache items will not expire on their own,
| but will remain cached until they are deleted (or cease to exist,
| depending on the driver).
*/

$config['ce_cache_seconds'] = 0;

/*
| If you would like the whitespace before and after the content you pass
| in to your 'save' and 'it' tags to be automatically removed before being
| cached, set this to 'yes'. The default is 'no'.
*/

$config['ce_cache_trim'] = 'yes';

/*
| This will be the default id to use for It and Save tags if they don't
| have an id and do not have the global="yes" parameter. If this setting
| is not included, then it will default to 'item'.
*/

$config['ce_cache_id'] = 'page';

/*
| You can optionally create a secret key if you are worried about someone
| guessing your EE action_id to break your cache or view your cached item
| names through jsonp requests.
*/

$config['ce_cache_secret'] = 'your_key_here';

/*
| To temporarily turn off CE Cache, you can use this option. This can be
| useful when developing a site.
*/

$config['ce_cache_off'] = 'yes';

/*
| Sometimes bots will go on a rampage and ping a whole bunch of URLs that
| don't exist. If all pages don't have proper 404 handling, this can create
| *a lot* of unnecessary caches. For this reason, new caches will not be
| created when a page is accessed by a bot, but any previously created
| caches for the page will still be returned. To cache pages regardless
| of whether or not they are accessed by a bot, set this to 'no'. The
| default is 'yes'.
*/

$config['ce_cache_block_bots'] = 'no';

/*
| Limit fragment (non-static, using the It or Save tags) caching to logged
| out users? The default is 'no'. This can be overridden by the
| logged_in_only= and logged_out_only= tag parameters.
*/

$config['ce_cache_fragment_logged_out_only'] = 'no';

/*
| Limit fragment caching to logged in users? The default is 'no'. This can be
| overridden by the logged_in_only= and logged_out_only= tag parameters.
*/

$config['ce_cache_fragment_logged_in_only'] = 'yes';

/*
| This must be set to 'yes' in order for items to be cached via the static
| driver. The default is 'no'.
*/

$config['ce_cache_static_enabled'] = 'yes';

/*
| If you are using the static driver, and need to override the path to
| its cache directory, this setting is for you.
*/

$config['ce_cache_static_path'] = '/server/path/to/web_root/static';

/*
| Limit static (using the Stat:ic tag) caching to logged out users? The
| default is 'no'. This can be overridden by the logged_in_only= and
| logged_out_only= tag parameters. You will also need to look at the
| Static Driver Installation instructions in the control panel (under
| the "Logged Out Only" heading) for instructions on setting up your
| .htaccess to get this setting to work.
*/

$config['ce_cache_static_logged_out_only'] = 'yes';

/*
| Limit static caching to logged in users? The default is 'no'. This can be
| overridden by the logged_in_only= and logged_out_only= tag parameters.
*/

$config['ce_cache_static_logged_in_only'] = 'no';

/*
| If you are using the memcache driver and would like to add multiple
| servers, use this setting to specify them. If this setting is not
| specified, then it will default to:
| $config['ce_cache_memcache_servers'] = array(
|   array( '127.0.0.1' )
| );
| see http://www.php.net/manual/en/memcache.addserver.php
*/

$config['ce_cache_memcache_servers'] = array(
    array( '127.0.0.1', 11211, true, 15 ),
    array( 'memcache_host', 11211, true, 70 ),
    array( 'memcache_host2', 11211, true, 15  )
);

/*
| If you are using the memcached driver and would like to add multiple
| servers, use this setting to specify them. If this setting is not
| specified, then it will default to:
| $config['ce_cache_memcached_servers'] = array(
|   array( '127.0.0.1', 11211 )
| );
| see http://www.php.net/manual/en/memcached.addserver.php
*/

$config['ce_cache_memcached_servers'] = array(
    array( '127.0.0.1', 11211, 20 ),
    array( 'memcached_host', 11211, 20 ),
    array( 'memcached_host2', 11211, 40 )
);

/*
| You can specify one or more servers for the redis driver using this
| configuration option. If this setting is not specified, then it will
| default to:
| $config['ce_cache_redis_servers'] = array(
|   array( '127.0.0.1' )
| );
*/

$config['ce_cache_redis_servers'] = array(
    array( '127.0.0.1:6379' ),
    array( '10.0.0.1:6379' ),
    array( '10.0.0.2:6379' )
);

/*
| If your redis server is password protected, you can specify the
| password in this config setting. Authentication will be attempted
| after connecting and before executing commands.
*/

$config['ce_cache_redis_auth'] = 'foo';

/*
| A redis database index can be optionally specified using this setting.
*/

$config['ce_cache_redis_db_index'] = '1';

/*
| By default, CE Cache performs all cache breaking and refreshing
| asynchronously. However, if you are blocking your site with .htaccess
| authentication or cannot support the default asynchronous
| functionality for some other reason, adding this config item will
| allow the site to work synchronously instead. Please note that
| cache refreshing will not work in synchronous mode. The default is 'yes'.
*/

$config['ce_cache_async'] = 'no';

/*
| CE Cache first attempts to use cURL and then to fallback to
| fsockopen when making asynchronous requests. On rare occasions,
| however, people have had problems with cURL not being able to make
| the requests successfully. By setting this parameter to 'no', you
| effectively skip cURL, and only allow fsockopen to be used for
| the asynchronous requests.  The default is 'yes'.
*/

$config['ce_cache_curl'] = 'no';

/*
| Whether or not to enable flat static caching. View the Static Driver
| Installation tab in the CE Cache module control panel for more details.
*/

$config['ce_cache_static_flat'] = 'yes';

/*
| The url_prefix= is prepended to the cache item URL, even if the url is
| overridden via url_override=. This setting can be useful for sub-directory
| EE installations, and multi-language MSM sites, because EE does not include
| the folder path to the index.php directory in it's internal URL.
*/

$config['ce_cache_url_prefix'] = '';

/*
| By default, CE Cache will not cache pages that were requested via POST.
| If you would like change this functionality on an install-wide basis,
| you can add the following config item:
*/

$config['ce_cache_ignore_post_requests'] = 'no';

/*
| CE Cache will not cache 404 pages by default. If you would like CE Cache
| to cache 404 pages, set the following to 'no'. The default is 'yes'.
| * It is recommended that you leave this at its default value.
*/

$config['ce_cache_exclude_404s'] = 'yes';


/*
| The mode (permission level) to try and set the created image
| to. Must be octal. See http://php.net/manual/en/function.chmod.php for
| more info. Defaults to: 0644
*/

$config['ce_cache_file_permissions'] = 0644;

/*
| The mode (permission level) to try and set the created directories to.
| Must be octal. See http://php.net/manual/en/function.chmod.php for
| more info. Defaults to: 0775
*/

$config['ce_cache_dir_permissions'] = 0775;



// END CE Cache config items

MSM Configuration Overrides

When using Multiple Site Manager (MSM), you may sometimes need site-specific settings. Please note that you don’t need all of the settings. You may choose to only copy one or more as needed.

Settings specified in the global array will take precedence over settings specified in the config. Likewise, setting specified in the actual tag parameters will take precedence over both the config and global variable settings. You can use these settings as site-wide defaults for the current site.

You may add any of the following settings to the global_vars array in the site’s index.php file. If set, these settings will take precedence over the associated config settings. This is useful in an MSM environment when you want specific setting for one site that are different than the default settings.

$assign_to_config['global_vars']['ce_cache_drivers'] => 'file|db';
$assign_to_config['global_vars']['ce_cache_seconds'] => 0;
$assign_to_config['global_vars']['ce_cache_trim'] => 'yes';
$assign_to_config['global_vars']['ce_cache_id'] = 'page';

Note: The 'ce_cache_memcache_servers' and 'ce_cache_memcached_servers' settings should not be overridden on the site level, due to the break in the ability to use arrays in the global_vars array.