Introduction to Redis: Redis is a high-performance Key-value storage System (cache and store) issued under the BSD Open source protocol. It is commonly referred to as a data structure server, because the value can be a string (string), a hash (hashes), a list, a collection (sets), and an ordered collection (sorted sets). just learned ... Cache Type: Data cache, page cache (Smarty) Why use caching: Reduce the database load frequently accessed short-term unchanging data cache, reduce the speed of access, improve access speed installation ... Toss it for a while .... MAKE[3]: Gcc:command not found installed Gccyum install Gcc make complete. Copy cp redis-cli REDIS-SERVER/USR/LOCAL/REDIS/CP redis-cli redis.conf/usr/local/redis/ copy complete switch to/usr/local/redis Background run vim redis.conf about 17 lines then run ./redis-server redis.conf using  ./REDIS-CLI Command similar to MYSQL-UROOT-P enter Operation interface simple set name value get get name *****************************exists key test specify if key exists Returns 1 or 0 del key1 key2 Delete the specified Key keys patten return a matching key such as keys name*1) name12) name2 Randomkey return random key renaming rename Oldkey newkey expire key for key to know expiration time expire age 60//60 seconds expires, chant delete select Db-index Select Database 0-15select 5 ttl key to return key expiration time flushDB deletes all key *********************************** types in the current database:string -------------------List link list type --------------------hash ----------------------- -------------------------
Persistence:Snap shotting snapshot persistence//default on append only file (aof persistent) manually turn redis.conf-appendonly Yes
Master-Slave ... 。 From server configuration slaveof 192.168.17.88 6379/************************/consolidated to PHP dependent software Phpredis.tar.gztar ZXVF PHPREDIS.TAR.GZCD phpredis# using PHP to manipulate the dependent software/usr/local/php/bin/phpize# may need to install autoconf-2.62.tar.gz compile:./configure--with-php-config=/usr/ LOCAL/PHP/BIN/PHP-COF installation: Make && make install has successfully opened the extension: Vim php.iniextension=redis.so restart nginx php use redis< ? php $redis = new Redis (); Instantiate $redis->connect (' 192.168.17.88 ', ' 6379 '); $redis->set (' Redis ', ' success '); Run the file?>
Preliminary interview Redis