memcached turning off compression for certain keys

1.1k views Asked by At

I have certain keys that I'd like to use append / prepend methods on, but the memcached documentation says I need to have compression turned off. Now, I'm assuming I would like to have compression on for the remaining keys, so how would I go about turning off compression for just the append / prepend keys?

EDIT:

I'm currently looking at Memcached::OPT_COMPRESSION and when I do:

    $mem = new memcached();
    $mem->addServer('localhost', 11211);

    $mem->setOption(Memcached::OPT_COMPRESSION, false);

    $mem->set('test', '<br />Testing<br />', 300);

    $mem->append('test', 'hmm...');

    echo $mem->get('test');

the prepend / append work.

However, is it good practice to switch on / off the options whenever dealing with a specific key? I was under the impression that options should be set on memcached->addServer() and then never touched again.

0

There are 0 answers