In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces the meaning of redis in php. It has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let's take a look at it.
In php, redis, whose full name is Remote Dictionary Server (remote data Service), is an in-memory cache database whose data model is "key-value" and supports rich data structures, such as string, list, hash, etc., and can be persisted to ensure data security.
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
Redis is the abbreviation of Remote Dictionary Server (remote data Service), an in-memory cache database developed by Italian Antirez (Salvatore Sanfilippo). It is written in C language, its data model is key-value, and supports rich data structures (types), such as string, list, hash, set, sorted sort. It can be persisted to ensure the security of data.
Redis is an open source API that is written in ANSI C language, supports the network, can be memory-based and persistent, and provides API in multiple languages.
One of the main differences between Redis and other key-value databases is the ability of Redis to store and manipulate advanced data types. These data types are basic data structures (lists, mappings, collections, and sort sets) that most developers are familiar with. Redis's excellent performance, simplicity and atomic operation of data structures help to solve the problems that are difficult to implement or perform poorly when using traditional relational database implementations.
PHP uses Redis
Installation
Before we start using Redis in PHP, we need to make sure that the redis service and PHP redis driver are installed and that PHP can be used properly on your machine. Next, let's install the PHP redis driver: download it at https://github.com/phpredis/phpredis/releases.
PHP installs the redis extension
The following operations need to be done in the downloaded phpredis directory:
$wget https://github.com/phpredis/phpredis/archive/2.2.4.tar.gz$ cd phpredis-2.2.7 # enter the phpredis directory $/ usr/local/php/bin/phpize # php installation path $. / configure-- with-php-config=/usr/local/php/bin/php-config$ make & & make install
If you are in the PHP7 version, you need to download the specified branch:
Git clone-b php7 https://github.com/phpredis/phpredis.git
Modify the php.ini file
Vi / usr/local/php/lib/php.ini
Add the following:
Extension_dir = "/ usr/local/php/lib/php/extensions/no-debug-zts-20090626" extension=redis.so
Restart php-fpm or apache after the installation is complete. Look at the phpinfo information and you can see the redis extension.
Connect to the redis service
Execute the script and the output is as follows:
Connection to server sucessfullyServer is running: PONG
Redis PHP String (string) instance
Execute the script and the output is as follows:
Connection to server sucessfullyStored string in redis:: Redis tutorial
Redis PHP List (list) instance
Execute the script and the output is as follows:
Connection to server sucessfullyStored string in redisRedisMongodbMysql
Redis PHP Keys instance
Execute the script and the output is as follows:
Connection to server sucessfullyStored string in redis::tutorial-nametutorial-list thank you for reading this article carefully. I hope the article "what does redis mean in php" shared by the editor will be helpful to everyone? at the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.