Memcache function library is in pecl (PHP Extension Community Library), the main role is to build large-capacity memory data
Temporary storage area, in the distribution of the effect is very obvious, otherwise it is not recommended. I installed on Ubuntu
When you finish running the error:
/usr/local/memcached/bin/memcached:error while loading shared libraries:libevent-1.4.so.2:
Cannot open shared object File:no such file or directory
According to: "Libeven, memcached, Libmemcache Installation" method, using:
sudo ln-s/usr/local/lib/libevent-1.4.so.2/usr/lib/libevent-1.4.so.2
Can fix this bug
With the new memcached module that installs PHP, unregister the ";" in/etc/php5/conf.d/memcached.ini and restart Apache
, call Phpinfo () to appear memcached information
Perform:
$memcache = new Memcache ;
$memcache - Connect ( localhost , 11211 ) or Die ( "Could not Connect" );
$version = $memcache - getversion ();
Echo "Servers version:" . $version . "
" ;
?>
$memcache = new Memcache ;
$memcache - Connect ( localhost , 11211 ) or Die ( "Could not Connect" );
Print_r ( $memcache - GetStats ());
/**
* Array
* (
* [PID] = 8052
* [Uptime] = 9205
* [TIME] = 1205898428
* [Version] = 1.2.5
* [Pointer_size] = 32
* [Rusage_user] = 0.008000
* [Rusage_system] = 0.000000
* [Curr_items] = 1
* [Total_items] = 17
* [bytes] = 57
* [Curr_connections] = 2
* [Total_connections] = 15
* [Connection_structures] = 3
* [Cmd_get] = 9
* [Cmd_set] = 23
* [Get_hits] = 5
* [Get_misses] = 4
* [Evictions] = 0
* [Bytes_read] = 671
* [Bytes_written] = 850
* [Limit_maxbytes] = 10485760
* [Threads] = 1
* )
*/
?>
$memcache = new Memcache ;
$memcache - Connect ( localhost , 11211 ) or Die ( "Could not Connect" );
$memcache - Set ( name , Leo , 0 , - );
if (! $memcache - Add ( name , Susan , 0 , - ))
{
Echo Susan is exist ;
};
$memcache - Replace ( name , Lion , 0 , - );
Echo $memcache - get
http://www.bkjia.com/phpjc/ 486423.html www.bkjia.com true http://www.bkjia.com/phpjc/486423.html techarticle Memcache function library is in PECL (Phpextensioncommunitylibrary), the main role is to build a large amount of memory data in the temporary storage area, in the distribution of the role of the very obvious, ...