使用php查找memcached大小

使用php查找memcached大小

问题描述:

I am using PHP memcached for storing records. But it is not storing more than 2000 records in the cache.

I am interesting in finding:

  1. How many records can be stored in Memcached?
  2. How to calculate the size of Memcached and what is the max limit to store in the cache?

我使用PHP memcached存储记录。 但它不会在缓存中存储超过2000条记录。 p>

我很有兴趣找到: p>

  1. 可以记录多少条记录 存储在Memcached中? li>
  2. 如何计算Memcached的大小以及缓存中存储的最大限制是什么? li> ol> div>

Memcached size is set by your host. You can generally have it increased, but it also usually costs to do so.

If you're developing on a local machine, according to memcached docs, you can set the limit with memcached -m [size].

I found a perl utility here that seems to dump out the exact information that you're looking for.

Maximum limit of the cache :

  • it depends on how much memory you indicated memcached can used -- this is done when starting memcached.
  • Note, though, that each item you store in cache cannot be more than 1 MB


Size of the data in cache, number of items in cache : there are PHP functions which can help with that ; depending on the extension you are using to connect to memcached, see :


Maximum number of items you can store in memcached :

  • I've never hit any limit on one server ; and I've not found any number in the FAQ
  • Anyway, if you hit any possible limit with the servers you are currently using, just add one additional daemon : memcached works as a cluster ;-)