title: PHP - Memcached : MySql resource caching
body: <p>This does not work</p>
  
  <pre><code>    $get_data_qry   = "SELECT * FROM list;";
      $get_data_res   = $db-&gt;Query($get_data_qry);
  
      $key           = 'someKey';  /** silly mistake corrected after being notified by comments*/
      $get_data_res   = $memcache-&gt;get($key);
  
      if ($get_data_res) {
          PushOutput($get_data_res);
          echo "&lt;br/&gt;Directly from cache";
      }
  
      else {
          $get_data_res   = $db-&gt;Query($get_data_qry);
          $memcache-&gt;set($key, $get_data_res, 0, 20000);  /*Store the MySql resource in the cache*/
          PushOutput($get_data_res);
      }
  </code></pre>
  
  <p><s>I get the following message: <code>PHP Warning: Memcache::set() expects parameter 1 to be string, resource given in E:\Repository\HTML\tooldent\songs\songList.tpl on line 54.</code></s></p>
  
  <p>It seems weird, why a resource cannot be cached? Any alternatives?</p>