phalcon: [Memcached] Multiple memcached instances conflict

Hello, I’ve set up a multi-site, the code is all shared between both sites. I Just change the db and caching port of the sites.

The problem is that the 2nd Application is getting keys from the 1st application. Maybe phalcon is caching the config array in someplace we don’t have access?

  • In Nginx I create a variable telling me which application i should run (it checks domain in nginx) So i set in index.php:
    if (isset($_SERVER['Website2']))
        $config = include __DIR__ . "/../app/config/config_2.php";
    else 
        $config = include __DIR__ . "/../app/config/config.php";

this is the configuration file that differs each website… It does work as planned because all data that is not cached comes without problems.

In services.php I set:

$di->setShared('modelsCache', function () use ($config) {
    $frontCache = new \Phalcon\Cache\Frontend\Data(array("lifetime" => 600));
$cache = new Phalcon\Cache\Backend\Libmemcached($frontCache, array(
     'servers' => array(
         array('host' => $config->memcache->host,
               'port' => $config->memcache->port,
               'weight' => 1
           ),
     ),
     'client' => array(Memcached::OPT_HASH => Memcached::HASH_MD5     )
 ));

    return $cache;
});
  • When i try to get content from the Models in Website2, it return content from Website1. When i do a dump of the result, it shows me that it got from the other server (also i check in memcached and it does not have the key set).

  • Is there a hidden place where i should set this (and it’s not in documentation so it would be a documentation bug)?

  • Is it a bug per se?

Thanks

Alan

Details

  • Phalcon version: (3.2.0)
  • PHP Version: (5.6.30)
  • Operating System: CentOS
  • Installation type: Compiling from source
  • Zephir version (if any):
  • Server: Nginx + PHP FPM
  • Other related info (Galera Mysql + Memcached (2 instances in same server different ports):

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 26 (3 by maintainers)

Most upvoted comments

I’m sorry I haven’t had time to get onto this. I’m still willing and able though - so I’ll try to reproduce it ASAP. I’ll bring on my findings for sure 😃

@stamster Great!

Let me know if you need any input/data or anything that i can test here!

Thank you! Alan