<?php if (!defined('BASEPATH')) exit('No direct script access allowed');


// --------------------------------------------------------------------------
// Servers
// --------------------------------------------------------------------------
$IpHostAllow =explode('.',GetIp());
//if($IpHostAllow['0']=='192' || $IpHostAllow['0']=='127')
$server_ip = $_SERVER['SERVER_ADDR'];

if($server_ip == '192.168.105.106')
{
	$memcached['servers'] = array(
		'default' => array(
			'host'      => '127.0.0.1',
			'port'      => '1122',
			'weight'    => '1',
			'persistent'    => FALSE	
		)
	);

	$memcached['servers2'] = array(
		'default' => array(
			'host'      => '127.0.0.1',
			'port'      => '1122',
			'weight'    => '1',
			'persistent'    => FALSE	
		)
	);

	$memcached['servers3'] = array(
		'default' => array(
			'host'      => '127.0.0.1',
			'port'      => '1122',
			'weight'    => '1',
			'persistent'    => FALSE	
		)
	);
}
else
{
	$memcached['servers'] = array(
		'default' => array(
			'host'      => rand_server(),
			'port'      => '11211',
			'weight'    => '1',
			'persistent'    => FALSE	
		)
	);

	$memcached['servers2'] = array(
		'default' => array(
			'host'      => rand_server(),
			'port'      => '11211',
			//'host'      => '172.17.1.168',
			//'port'      => '11211',
			'weight'    => '1',
			'persistent'    => FALSE	
		)
	);

	$memcached['servers3'] = array(
		'default' => array(
			'host'      => rand_server(),
			'port'      => '11211',
			'weight'    => '1',
			'persistent'    => FALSE	
		)
	);
}


function rand_server(){
   /* $ips = array('172.17.1.96','172.17.1.97');
    $key = array_rand($ips);
    return $ips[$key];
   */
   return '172.17.1.97';
}


// --------------------------------------------------------------------------
// Configuration
// --------------------------------------------------------------------------
$memcached['config'] = array(
    'prefix'    => '',  // Prefixes every key value (useful for multi environment setups)
    'compression'   => FALSE,   // Default: FALSE or MEMCACHE_COMPRESSED Compression Method (Memcache only).
    // Not necessary if you already are using 'compression'
    'auto_compress_tresh'   => FALSE,   // Controls the minimum value length before attempting to compress automatically.
    'auto_compress_savings' => 0.2, // Specifies the minimum amount of savings to actually store the value compressed. The supplied value must be between 0 and 1.
    'expiration'    => 3600,    // Default content expiration value (in seconds)
    'delete_expiration' => 0    // Default time between the delete command and the actual delete action occurs (in seconds) 
);





$config['memcached'] = $memcached;


/* End of file memcached.php */
/* Location: ./applications/config/memcached.php */