Skip to content

[BUG]: Memcached not working in Phalcon 5.4 cache adapter #16703

Open
@pandian1989

Description

@pandian1989

I recently upgraded from Phalcon 4.x to 5.4, but I'm encountering a cache issue with the Memcached adapter. I'm unable to store data on the Memcache server. Can anybody please help me on this.

$di->setShared(
    'cache',
    function () {
        $config = $this->getConfig();
        $serializerFactory = new SerializerFactory();
        $adapterFactory = new AdapterFactory($serializerFactory);

        $options = [
            'defaultSerializer' => 'Json',
            'lifetime'          => 7200,
            'servers'           => [
                0 => [
                    'host'   => 'localhost',
                    'port'   => '11211',
                ],
            ],
        ];

        $adapter = $adapterFactory->newInstance('libmemcached', $options);

        return new \Phalcon\Cache\Cache($adapter);
    }
);

Whenever use to save the cache always returning false

$this->cache->set('id', 20)

Also whenever use directly Memcached class it is working.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions