title: Sharing Memcache with PHP and Python
body: <p>I am trying to share a Memcache key between Python and PHP. Python writes the key and PHP reads it. I am using the Cakephp framework, with php-pecl-memcache (not php-pecl-memcached), and the python-memcache all python library.</p>
  
  <p>Python:</p>
  
  <pre><code>  mc = memcache.Client( ["127.0.0.1:11211"])
    key = "key1"
    value = 1323779849
    mc.set(key, value)
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>  echo Cache::read('key1', 'memcached');
  </code></pre>
  
  <p>PHP can't read the variable, I get weird "MemcachePool::get() [http://php.net/memcachepool.get]: Failed to uncompress data" errors; I suspect it has to do with memcached flags that are set differently in each library. </p>
  
  <p>This is what happens when I telnet to memcached:</p>
  
  <p>Python sets key:</p>
  
  <pre><code> get key1
   VALUE key1 1 12
   1323779849
   .
   END
  </code></pre>
  
  <p>PHP sets key:</p>
  
  <pre><code> get key1
   VALUE key 1 0 12
   1323779849
   END
  </code></pre>
  
  <ul>
  <li>Is there a way to override these flags and just 'do your own thing'?</li>
  <li>Are there php/python memcache libraries that play better together?</li>
  <li>Alternatively, is there a simple way to create a common memory space between python/php?</li>
  </ul>