yii --memcached cache configuration_PHP tutorial

WBOY
Release: 2016-07-14 10:09:58
Original
820 people have browsed it

Start->Run->Enter cmd, open memcached.exe on the command line, and enter the folder where it is located. Enter: memcached.exe -d install to install
Enter memcached.exe -d start to start

Open the yii configuration file: config/main.php and add under components:
[html]
'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,                               ),
),
),

'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,
),
),
),

Use:
[html]
Yii::app()->memcache->get(id);
Yii::app()->memcache->set(id,value,time);

Yii::app()->memcache->get(id);
Yii::app()->memcache->set(id,value,time);




http://www.bkjia.com/PHPjc/477582.html

www.bkjia.com

true

http: //www.bkjia.com/PHPjc/477582.html

Start-Run-enter cmd, open memcached.exe on the command line, in the folder where it is located, enter: memcached.exe - d install Install and enter memcached.exe -d start to start and open the yii configuration file: conf...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!