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 > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article uses easy-to-understand examples to introduce how to cache redis, the code is very detailed, interested friends can refer to, hope to be helpful to you.
How do I cache redis?
First of all, to use redis, you need to install it on the server in advance. The installation command is yum install redis (using Centos system). After using this command, the yPay option will pop up. Just select Y. I won't say any more here because it has already been installed.
After installing redis-sever, check to see if there is any redis extension in php, if not, install the redis extension, and if so, you can use it directly. Php extensions can be viewed using php-m
After the extension is installed successfully, you can use php to use the redis extension. Generally, you can use Redis to create instantiation directly after installing the extension.
$redis = new Redis () / / instantiate redis$redis- > connect ('127.0.0.1) / / 127.0.0.1 is the connection address, and 6379 is the port number
In php, you can use:
$reids- > lpush ('key name', 'key value'), this is the storage queue; $redis- > set ('key name', 'key value'), this is storage string;$redis- > hset ('key name', 'key value'), this is hash
You can also use redis-cli to connect, but note that the redis-cli-h connection address-a password / port, makes a remote connection.
On how to cache redis to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.