Skip to content
This repository has been archived by the owner on May 16, 2018. It is now read-only.

Cache Backend memcache und libmemcached do not store raw data #7

Closed
zfbot opened this issue Apr 5, 2013 · 3 comments
Closed

Cache Backend memcache und libmemcached do not store raw data #7

zfbot opened this issue Apr 5, 2013 · 3 comments

Comments

@zfbot
Copy link

zfbot commented Apr 5, 2013

Jira Information

Original Issue:ZF-12396
Issue Type:Improvement
Reporter:Frank Ruske
Created:08/31/12
Assignee:Alexander Veremyev
Components:Zend_Cache

Description

In Zend_Cache_Backend_Libmemcached::save() and Zend_Cache_Backend_Memcached::save()

You will find the following line:

$result = @$this->_memcache->set($id, array($data, time(), $lifetime), $lifetime);

The Problem is that there will always an array be stored at the memcache server.
There should be an option to store a raw string since automatic_serialization has no affect here.

My hotfix is to remove time() and $lifetime. Since this results in problems for the session memcached handler i use an custom backend for the fix.

$result = $this->_memcache->set($id, $data, $lifetime);

In my setup im reading values stored in memcached directly using the NGINX memcached extension and the $request_uri as memcache key.
If the memcache server has a key matching the $request_uri then the content is directly delivered to the user.
This response will include time() and $lifetime values stored in memcache by the Zend Framework Backend Class. Only if the NGINX memcached Extension has no cache hit the php-fpm backend is called.

@zfbot
Copy link
Author

zfbot commented Apr 5, 2013

(Originally posted by: Frank Ruske on 09/02/12)

Also Zend_Cache_Backend_Libmemcached::load() and Zend_Cache_Backend_Libmemcached::test()
have to be adjusted.

EQ for LOAD function:

if (true === is_array($tmp)) {
    if (isset($tmp[0])) {
        return $tmp[0];
    }
    // Raw Data returned? 
} elseif (false !== $tmp) {
    return $tmp;
}
return false;

I think best would be to have some option flag like options.saveRawData.

@zfbot
Copy link
Author

zfbot commented Apr 5, 2013

This issue was ported from the ZF2 Jira Issue Tracker at
http://framework.zend.com/issues/browse/ZF-12396

Known GitHub users mentioned in the original message or comment:

@froschdesign
Copy link
Member

We will not add any new features or functionality for ZF1.
Please make your proposal in ZF2. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants