title: How to use memcache or memcached in GAE php?
body: <p>I have been using the GAE or Google App Engine for PHP for sometime and use a basic cloudSQL to read data from it. Since it been a few months and inorder to optimize it I wanted to reduce the number of reads the auto fill in the form uses to read names from Table. As of not it is as high as 80k per day which is insanely high for a simple form.</p>
  
  <p>Since Google does not allow me to write to a text file or any other temp file without a bucket ( <em>I don't have bucket .. for that matter why do we need one?</em> ) I figured I use a <strong>cache</strong> feature that I can have it <strong>refresh every day</strong> and then do the read queries of from the cache instead of the actual Table hence reducing the number of reads.</p>
  
  <p>That's were I ran into a wall. I am a beginner in this and all though a experienced pro may understand this </p>
  
  <p><a href="https://developers.google.com/appengine/docs/php/memcache/#PHP_PHP_memcache_implementation" rel="nofollow">https://developers.google.com/appengine/docs/php/memcache/#PHP_PHP_memcache_implementation</a></p>
  
  <p><em>I have no idea what it says.</em> </p>
  
  <p>Can any one teach me or tell me how to use the cache feature of GAE? I tried searching for a "How to" but didn't find one.</p>
  
  <p>My autocomplete function looks like this</p>
  
  <pre><code>setAutoComplete("name", "results1", "autocomplete.php?part=");
  </code></pre>
  
  <p>so it calls autocomplete php whenever a text is entered in the form after a keyup.</p>
  
  <p>And the SQL part of it looks like this </p>
  
  <pre><code>$sql = "SELECT SUBSTRING(NAME,1,300) AS Name FROM `Table` WHERE Name LIKE '{$p}%'";
  // Check Query ran sucessfully
  $query = mysql_query($sql) or die("Query failed: " . mysql_error() . " Actual query: " . $query);
  //Create an array with the results
  $results = array();
  while ($user = mysql_fetch_object($query)) {
      $results[] = $user -&gt; Name;
      }
  //using JSON to encode the array
  echo json_encode($results);
  </code></pre>
  
  <p>Hope this is able to paint a clear picutre. Thank you in advance from me and any one else who might come here looking for a similar answer.</p>
  
  <p>P.S - I am reading <a href="http://php.net/manual/en/book.memcache.php" rel="nofollow">PHP Manual</a> not really helping much.</p>