Kohana Cache configuration 2


APC settings

'apc'      => array
(
    'driver'             => 'apc',
    'default_expire'     => 3600,
),

SQLite settings

'sqlite'   => array
(
    'driver'             => 'sqlite',
    'default_expire'     => 3600,
    'database'           => APPPATH.'cache/kohana-cache.sql3',
    'schema'             => 'CREATE TABLE caches(id VARCHAR(127) PRIMARY KEY,
                                      tags VARCHAR(255), expiration INTEGER, cache TEXT)',
    'default_expire'     => 3600,
),

Eaccelerator settings

'eaccelerator' array
(
    'driver'             => 'eaccelerator',
),

Xcache settings

'xcache'   => array
(
    'driver'             => 'xcache',
    'default_expire'     => 3600,
),

File settings

'file'    => array
(
    'driver'             => 'file',
    'cache_dir'          => 'cache/.kohana_cache',
    'default_expire'     => 3600,
)

Override existing configuration group

The following example demonstrates how to override an existing configuration setting, using the config file in/application/config/cache.php.
<?php defined('SYSPATH') or die('No direct script access.');
return array
(
    // Override the default configuration
    'default'   => array
    (
        'driver'         => 'memcache'// Use Memcached as the default driver
        'default_expire' => 8000,        // Overide default expiry
        'servers'        => array
        (
            // Add a new server
            array
            (
                'host'       => 'cache.domain.tld',
                'port'       => 11211,
                'persistent' => FALSE
            )
        ),
        'compression'    => FALSE
    )
);

Add new configuration group

The following example demonstrates how to add a new configuration setting, using the config file in/application/config/cache.php.
<?php defined('SYSPATH') or die('No direct script access.');
return array
(
    // Override the default configuration
    'fastkv'   => array
    (
        'driver'         => 'apc'// Use Memcached as the default driver
        'default_expire' => 1000,   // Overide default expiry
    )
);

0 comments:

Post a Comment