Memcached

同時安裝和啟用 Memcache 和 Memcached

  • February 9, 2017

我可以在同一台伺服器上同時使用Memcache和**Memcached php 擴展嗎?**為了清楚起見,您不會誤解我的意思,這是我的情況:我的網站同時擁有 Joomla 和 phpbb。Joomla 提供對 memcached 和 memcache 的支持,而 phpbb 僅提供對 memcache 的支持。所以我打算這樣做:

1)安裝memcached伺服器:apt-get install memcached

  1. 安裝 php-memcache 以用於 phpbb:apt-get install php5-memcache

  2. 安裝 php-memcached 以用於 Joomla:apt-get install php5-memcached

我的問題是:

  1. 是否可以同時安裝和啟用 memcache 和 memcached 擴展,其中每個擴展都由不同的 php 應用程序同時使用?這會以任何方式發生衝突嗎?
  2. 當我將 memcached 伺服器的記憶體限制設置為 512M in 時 /etc/memcached.conf,是否意味著此記憶體限制將在兩個擴展memcache之間共享?memcached如果說 memcache 使用比 memcached 更多的記憶體,這應該不是問題,反之亦然?他們兩個玩得很好嗎?
  3. 在這樣的場景中,我是否應該嘗試僅優先使用 1 個 php 擴展(例如僅在我的情況下的 memcache)以使事情保持簡單而不會在兩者之間發生衝突,否則這無關緊要。我的意思是,如果您說兩者都可以使用(對於 Q1),那麼出於專業實踐,即使兩者可以同時使用,我是否仍然嘗試為 Joomla 和使用相同的 php 擴展phpbb 是否可以盡量減少頭痛?這會有什麼不同嗎?

@Alin Andrei 發布了這個問題的正確答案。我在這裡引用他的話,因為答案隱藏在評論中。功勞歸於他:

1. memcache and memcached are two separate extensions that do not depend on each other so yes you can have them both installed. 

2. if both extensions use the same memcached server, then yes the memory is shared between them, you can keys from both extensions but only the size of 512 

3. if you can use the same extension on both apps then use only one to simplify the complexity you have. You could both of them as well, i dont think it will increase in size if you use both of them

引用自:https://serverfault.com/questions/639701