google app engine - How to use memcache or memcached in GAE php? -


i have been using gae or google app engine php sometime , use basic cloudsql read data it. since been few months , inorder optimize wanted reduce number of reads auto fill in form uses read names table. of not high 80k per day insanely high simple form.

since google not allow me write text file or other temp file without bucket ( i don't have bucket .. matter why need one? ) figured use cache feature can have refresh every day , read queries of cache instead of actual table hence reducing number of reads.

that's ran wall. beginner in , though experienced pro may understand

https://developers.google.com/appengine/docs/php/memcache/#php_php_memcache_implementation

i have no idea says.

can 1 teach me or tell me how use cache feature of gae? tried searching "how to" didn't find one.

my autocomplete function looks this

setautocomplete("name", "results1", "autocomplete.php?part="); 

so calls autocomplete php whenever text entered in form after keyup.

and sql part of looks

$sql = "select substring(name,1,300) name `table` name '{$p}%'"; // check query ran sucessfully $query = mysql_query($sql) or die("query failed: " . mysql_error() . " actual query: " . $query); //create array results $results = array(); while ($user = mysql_fetch_object($query)) {     $results[] = $user -> name;     } //using json encode array echo json_encode($results); 

hope able paint clear picutre. thank in advance me , 1 else might come here looking similar answer.

p.s - reading php manual not helping much.

i used both memcache api's supported in gae(memcache , memcached) .this memcache code.(i assume query working properly)

    $data = array();     $key = 'memcahcetestkey';     $memcache = new memcache;     $data = $memcache->get($key);     if ($data === false) {       $data = $results ;//yourqueryresult;       $memcache->set($key, $data);     } 

then check memcache values using $your_memecach_array=$memcache->get($key);


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -