CS174
Chris Pollett
Nov. 22, 2010
http://www.cs.sjsu.edu/faculty/pollett/in this network I simple make a request to:
http://www.cs.sjsu.edu.nyud.net/faculty/pollett/i.e., I tack on .nyud.net to the domain name.
Array( "name" => "Bob", ..., "posts" => Array([0] => Array("title" => "Dark and Stormy Night", ...), [1]=>...))
Which of the following statements is true?
pecl install Memcacheand then add the line
extension=memcache.so(or .dll on Windows) to your php.ini file and restart everything.
memcached -d -m 50 -l 127.0.0.1 -p 11211
telnet 127.0.0.1 11211 set foo 0 0 6 lalala STORED
VALUE key flags bytes\r\n data block\r\none for each value returned, followed by an END\r\n after the last value.
get foo VALUE foo 0 6 lalala END
$memcache = new Memcache();
$memcache->addServer($host, $port, $persistent, $weight, $timeout, $retry_interval);
$memcache->set($key, $val, $flag, $expire); // $flag is whether to compress the item in the store //$expire - Unix timestamp, or seconds from present. 0 -don't expire
$memcache->get($key);
<html> <head><title>Memcache Test</title></head> <body> <h1>Test</h1> <?php $memcache = new Memcache(); $memcache->addServer("localhost", 11211, true, 1, 1, 5); $memcache->set("bob", "value", null, 60); echo "<p>".$memcache->get("bob")."</p>"; ?> </body> </html>