Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use redis to realize the function of second kill cache in thinkphp

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Thinkphp how to use redis to achieve second-kill cache function, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

1. Install redis and install the corresponding redis extension according to your php version

First look at the phpinfo (); php environment information

2, download redis

Https://windows.php.net/downloads/pecl/snaps/redis/https://windows.php.net/downloads/pecl/releases/igbinary/

Be sure to make sure that the downloaded version corresponds to php

3. After unzipping, copy php_redis.dll and php_redis.pdb to php's ext directory

4. Modify php.ini, (PS: this php.ini file is in the Apache directory) and add to the file:

; php_redisextension=php_igbinary.dllextension=php_redis.dll

Note: extension=php_igbinary.dll must be placed in front of extension=php_redis.dll, otherwise this extension will not take effect

5. After restarting Apache, use phpinfo to see if the extension is installed successfully

When configuring redis in config, my example uses thinkphp5.0.

Then create a new module folder under extend to create a Redis.php file

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report