I'm Confused with Memcache vs Memcached vs php5-memcache

后端 未结 2 853
暖寄归人
暖寄归人 2020-12-21 07:27

I followed the instruction in this tutorial on how to install nginx, php, and mysql including the php5-memcache.

I\'m wondering if I still need to install the memcac

相关标签:
2条回答
  • 2020-12-21 07:45

    memcache and memcached are 2 different servers, each has some features and stuff, you can read the differences as there's so many previous questions about that check google search

    The ones starting with php are the extentions used to access the service, just like to use mysql you need php5-mysql, and to use curl you need php5-curl.

    So you have php5-memcache for memcache, and php5-memcached for memcached, you can read about what each provide from those links:
    memcached lib and memcahe lib

    EDIT: Just want to correct the wrong info I wrote above, both php5-memcache and php5-memcached connect to the memcached server, they are just different extensions for the same server, I guess just like php5-mysql vs php5-mysqli

    You can still use both together, there's no conflict, but i believe you only need one not both, because most features are available with both, some provide little more features, another candidate service is redis, you should read into that too, it has some features not available in the memcached servers.

    0 讨论(0)
  • 2020-12-21 07:47

    The names of these extensions are confusing.

    Actually, both php5-memcache and php5-memcached are PHP extensions for working with the memcached service (Memcached server). They both give your PHP processes, the ability to be clients to the memcached service, i.e. to connect to memcached over the network, and to speak the memcached protocol, in order to use the memcached API.

    The php5-memcached extension is more stable and has more features in my opinion, so I would suggest, that it should be tried first. Most of its operations are faster too (php source for the benchmark that produced these results).

    You still do need the actual memcached service started somewhere, and its address, in order to connect to it. The memcached service may be started on the same host, or on another host/hosts, if you want a distributed cache.

    0 讨论(0)
提交回复
热议问题