Work on memcached server

This commit is contained in:
Laurent Destailleur 2010-05-26 11:22:10 +00:00
parent 96933ce293
commit be52d8b46f
2 changed files with 10 additions and 5 deletions

View File

@ -50,7 +50,8 @@ function dol_setcache($memoryid,$data)
{
$memoryid=session_name().'_'.$memoryid;
$m=new Memcached();
$result=$m->addServer($conf->global->MEMCACHED_SERVER, $conf->global->MEMCACHED_PORT);
$tmparray=explode(':',$conf->global->MEMCACHED_SERVER);
$result=$m->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
//$m->setOption(Memcached::OPT_COMPRESSION, false);
$m->add($memoryid,$data);
$rescode=$m->getResultCode();
@ -67,7 +68,8 @@ function dol_setcache($memoryid,$data)
{
$memoryid=session_name().'_'.$memoryid;
$m=new Memcache();
$result=$m->addServer($conf->global->MEMCACHED_SERVER, $conf->global->MEMCACHED_PORT);
$tmparray=explode(':',$conf->global->MEMCACHED_SERVER);
$result=$m->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
//$m->setOption(Memcached::OPT_COMPRESSION, false);
$result=$m->add($memoryid,$data);
if ($result)
@ -102,7 +104,8 @@ function dol_getcache($memoryid)
{
$memoryid=session_name().'_'.$memoryid;
$m=new Memcached();
$result=$m->addServer($conf->global->MEMCACHED_SERVER, $conf->global->MEMCACHED_PORT);
$tmparray=explode(':',$conf->global->MEMCACHED_SERVER);
$result=$m->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
//$m->setOption(Memcached::OPT_COMPRESSION, false);
$data=$m->get($memoryid);
$rescode=$m->getResultCode();
@ -121,7 +124,8 @@ function dol_getcache($memoryid)
{
$memoryid=session_name().'_'.$memoryid;
$m=new Memcache();
$result=$m->addServer($conf->global->MEMCACHED_SERVER, $conf->global->MEMCACHED_PORT);
$tmparray=explode(':',$conf->global->MEMCACHED_SERVER);
$result=$m->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
//$m->setOption(Memcached::OPT_COMPRESSION, false);
$data=$m->get($memoryid);
//print "memoryid=".$memoryid." - rescode=".$rescode." - date=".sizeof($data)."\n<br>";

View File

@ -712,7 +712,7 @@ $heightforframes=48;
/**
* \brief Show HTML header HTML + BODY + Top menu + left menu + DIV
* \param head
* \param head Add optionnal head lines
* \param title
* \param help_url
* \param target
@ -885,6 +885,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
print '""];';
print '</script>'."\n";
if (! empty($head)) print $head."\n";
if (! empty($conf->global->MAIN_HTML_HEADER)) print $conf->global->MAIN_HTML_HEADER."\n";
print "</head>\n\n";