Skip to content

Commit

Permalink
Solve conflict of var name
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Sep 7, 2015
1 parent c9264fa commit 9667b6a
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions htdocs/core/lib/memory.lib.php
Expand Up @@ -47,20 +47,20 @@ function dol_setcache($memoryid,$data)
// Using a memcached server
if (! empty($conf->memcached->enabled) && class_exists('Memcached'))
{
global $m;
if (empty($m) || ! is_object($m))
global $dolmemcache;
if (empty($dolmemcache) || ! is_object($dolmemcache))
{
$m=new Memcached();
$dolmemcache=new Memcached();
$tmparray=explode(':',$conf->global->MEMCACHED_SERVER);
$result=$m->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
$result=$dolmemcache->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
if (! $result) return -1;
}

$memoryid=session_name().'_'.$memoryid;
//$m->setOption(Memcached::OPT_COMPRESSION, false);
//$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false);
//print "Add memoryid=".$memoryid;
$m->add($memoryid,$data); // This fails if key already exists
$rescode=$m->getResultCode();
$dolmemcache->add($memoryid,$data); // This fails if key already exists
$rescode=$dolmemcache->getResultCode();
if ($rescode == 0)
{
return count($data);
Expand All @@ -72,18 +72,18 @@ function dol_setcache($memoryid,$data)
}
else if (! empty($conf->memcached->enabled) && class_exists('Memcache'))
{
global $m;
if (empty($m) || ! is_object($m))
global $dolmemcache;
if (empty($dolmemcache) || ! is_object($dolmemcache))
{
$m=new Memcache();
$dolmemcache=new Memcache();
$tmparray=explode(':',$conf->global->MEMCACHED_SERVER);
$result=$m->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
$result=$dolmemcache->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
if (! $result) return -1;
}

$memoryid=session_name().'_'.$memoryid;
//$m->setOption(Memcached::OPT_COMPRESSION, false);
$result=$m->add($memoryid,$data); // This fails if key already exists
//$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false);
$result=$dolmemcache->add($memoryid,$data); // This fails if key already exists
if ($result)
{
return count($data);
Expand Down

0 comments on commit 9667b6a

Please sign in to comment.