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

Distributed memcache

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Operate memcache under php:

1. Connect to the memcache server

$mem=new Memcache

$mem- > addServer ("192.168.0.1", "11211")

two。 Increase

$mem- > set ('name','user1')

3. Delete

$mem- > delete ('name')

4. Change

$mem- > set ('age',200)

5. Check

Echo $mem- > get ('age')

6. View statu

$arr=$mem- > getStats ()

7. Empty

$mem- > flush ()

[example: php+memcache caches dynamic data]

[example: cross-domain login of php+memcache users]

Php saves session to a shared memcache server when the user logs in:

[Session]

1.session.save_handler = memcache

2.session.save_path = "tcp://192.168.0.1:11211"

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

Servers

Wechat

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

12
Report