title: Memcache->get return different array
body: <p>i made this function:
  /* MEMCACHE */</p>
  
  <pre><code>function cache_query($sql,$nombre,$tiempo = -1){
      $cache = new Memcache();
      $cache-&gt;pconnect('localhost',11211);
      $query_cacheada = $cache-&gt;get($nombre);
      if ( $query_cacheada  === false ) {
               /* key not in memcache, perfom query, cache it and return */
           $res = mysql_query($sql);
           $cache-&gt;set($nombre,$res, 0, 60*60*24);  
           return $res; /* this looks good */
      }else{
               /* key in memcache, just return cached  */
           return $query_cacheada;  /* this doesnt return right elements */
      }
  }
  </code></pre>
  
  <p>wich i am using so:</p>
  
  <pre><code>class text{
  
      protected $id;
      protected $key;
      protected $language;
      protected $text;
  
      function __construct($clave,$lan){
         $consulta = cache_query("SELECT * FROM textos  
                                  WHERE clave = '$clave' AND lengua = '$lan'" ,"TRANSLATION_".$clave."_".$lan);
  
  
          if(mysql_num_rows($consulta)&gt;0){
              while($item = mysql_fetch_array($consulta)){
                  $this-&gt;id = $item['id'];
                  $this-&gt;clave = $item['key'];
                  $this-&gt;lengua = $item['language'];
                  $this-&gt;texto = $item['text'];
  
              }
                  return true;
           }
      }
      function get_text(){
            return $this-&gt;text;
      }
  }
  function translation($key,$language){
       $tem = new text($key,$language);
       return $tem-&gt;get_text();
  }
  </code></pre>
  
  <p>then:</p>
  
  <pre><code>$translationText = translation('hello','fr');
  </code></pre>
  
  <p>The problem is that it stores in cache arrays (always zero), <code>var_dump($m-&gt;get(k))</code> returns:</p>
  
  <p><code>int(0) int(0) int(0) int(0) int(0) int(0) int(0) int(0) int(0) int(0) int(0)</code> .....</p>
  
  <p>And <strong>the $sql query is fine</strong> because the rows are collected fine and printed fine, the problem is with the stored value..</p>
  
  <p>I have cleared the cache doing (several times, to make sure the values are not from a previous wrong output): </p>
  
  <pre><code>$consulta = $cache-&gt;get($nombre);
               /* manually*/
               $consulta = false;
          if ( $consulta === false) {
              $consulta = mysql_query($sql);
              $cache-&gt;set($nombre,$consulta, MEMCACHE_COMPRESSED, 60*60*24);
          };
  </code></pre>
  
  <p>so.. what am I missing?</p>
  
  <p>EDIT</p>
  
  <p>Here is a codepad, the problem is the mysql_query and memecache is not enabled, but in case someone wants to fiddle with it a bit</p>
  
  <p><a href="http://codepad.viper-7.com/PJNepH" rel="nofollow">http://codepad.viper-7.com/PJNepH</a></p>