How to configure and use memcached cache in Yii
The example in this article describes how to configure and use memcached cache in Yii. Share it with everyone for your reference, the details are as follows:
1. Download the memcached software package, unzip it, and put memcached.exe in any place, such as: d:/memcached/.
2. Start->Run->Enter cmd, open memcached.exe on the command line, in the folder where it is located, enter: memcached.exe -d install Installation
3. Enter memcached. exe -d start Start
4. Add extension=php_memcache.dll.
5. Open the yii configuration file: config/main.php, and add under components:
'memcache'=>array( 'class'=>'CMemCache', 'servers'=>array( array( 'host'=>'127.0.0.1', 'port'=>11211, 'weight'=>60, ), array( 'host'=>'127.0.0.1', 'port'=>11211, 'weight'=>40, ), ), ),
6. Use:
Yii::app()->memcache->get(id); Yii::app()->memcache->set(id,value,time);
I hope this article will help everyone based on Yii Frameworks for PHP programming help.
For more articles related to Yii configuration and using memcached cache, please pay attention to the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
