[eluser]Unknown[/eluser]
codeigniter 2.1.4
application/autoload.php
Code:
$autoload['libraries'] = array('database','cache');
system/libraries/Cache
Cache is cache
system/libraries/cache
system/libraries/Driver.php
48 line, delete ucfirst
Code:
- $lib_name = ucfirst(strtolower(str_replace('CI_', '', $this->lib_name)));
+ $lib_name = strtolower(str_replace('CI_', '', $this->lib_name) );
application/config/config.php
append code
Code:
$config['autoload_cache'] = array('adapter' => 'memcached');
application/config/memcached.php
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$config= array(
'default' => array(
'hostname' => '127.0.0.1',
'port' => 11211,
'weight' => 80
)
);
/* End of file memcached.php */
/* Location: ./application/config/memcached.php */
system/libraries/cache/cache.php
Code:
if ( ! class_exists('CI_Driver_Library')){
// we aren't instantiating an object here, that'll be done by the Library itself
require BASEPATH.'libraries/Driver.php';
}
class CI_Cache extends CI_Driver_Library {
protected $valid_drivers = array(
'cache_apc', 'cache_file', 'cache_memcached', 'cache_dummy'
);
protected $_cache_path = NULL; // Path of cache files (if file-based cache)
protected $_adapter = 'dummy';
protected $_backup_driver;
// ------------------------------------------------------------------------
/**
* Constructor
*
* @param array
*/
public function __construct($config = array())
{
if (empty($config))
{
$config = config_item('autoload_cache');
}
if ( ! empty($config))
{
$this->_initialize($config);
}
}