Basic use cases of redis in PHP and redisPHP. The basic use cases of redis in PHP, and the use cases of redisPHP download www. oschina. after netpredis is decompressed, it contains the lib source file, examples example, and test the basic use case
Php connection to redis database predis operations Daquan
Predis is the php database for connecting to redis. because it is fully written in php and uses a lot of namespace and closure functions, it only supports php5.3 and later versions,
Use AutoLoad to load related libraries, this point is to require $file; Spl_autoload_register (function ($class) {$file = __dir__. ' /lib/predis/'. $class.
PHP ';
if (file_exists ($file)) {require $file; return true;}});
Configure the connected IP,
Use AutoLoad to load the relevant library, this is the key torequire$file; Spl_autoload_register (function ($class) {$file = __dir__. ' /lib/predis/'. $class. PHP '; if (file_exists ($file)) {require $file; return true;}); /Configure the connected
Introduced
Redis is a key-value storage system. Like memcached, it supports a relatively larger number of stored value types, including string (string), list (linked list), set (set), Zset (sorted set– ordered set), and hash (hash type). These data
Predis is the PHP connection Redis Operation Library, because it completely uses PHP writing, a lot of use of namespaces and closures and other functions, only support php5.3 above, so the measured performance, 25,000 times per second read and write.
Download Http://www.oschina.net/p/redisAfter decompression, there are: Lib source files, examples examples, test testsCopy the Lib directory to your project and you can start your Predis operation.Use AutoLoad to load the relevant library, the focus
1. Problems with the mysql+memcached architecture
The actual MySQL is suitable carries on the massive data storage, through memcached hot spot data loading to the cache, speeds up the visit, many companies have used this kind of architecture, but
Redis is a high-performance key-value database. The emergence of redis largely compensates for the shortage of keyvalue storage such as memcached, and can play a good complementary role in relational databases in some cases. It provides Python, Ruby,
Message passing is widely used in various websites. This function is also essential for a website. This article mainly introduces the application of Redis in php-message transmission. Next, let's take a look at the small series. message passing is
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.