Will your keys used in memcache get any conflicts with my keys if i set cache_to_memcache ?

Topics: Developer Forum, Project Management Forum, User Forum
Oct 23, 2012 at 8:35 AM

if i do like this:

$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_memcache;
$cacheSettings = array( 'memcacheServer'  => 'localhost',
                        'memcachePort'    => 11211,
                        'cacheTime'       => 600
PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
We all know that in memcache,we store things with a unique key like:(key_apple,value_apple)


1: will the keys  used in the cache mechanism above get any conflicts if i have already used memcache ?

2:Will the object in the memcache be called many times ?  This will perform bad if it takes many trips between memcache memory and  the real memory .

If a thousand users will do something using cache_to_memcache  at the same time and the cache_to_memcache makes the object of each cell travel so many times in the memory,

that will be a disaster to me!!

Oct 23, 2012 at 10:10 PM

1. Highly unlikely, but not completely impossible. PHPExcel generates a random prefix to use for each worksheet. The code is visible if you want to check how it works for yourself.

2. Almost certainly, though it depends how much your script is accessing the cells. If I was hitting the kind of demands that you're getting, then I'd be using something like redis instead of memcache, and would write a redis cache storage object.

If you're hitting 1000 concurrent users, you should really be running multiple servers and multiple memcache servers anyway. That's pretty serious activity. You should also be refactoring PHPExcel activity to background processes in that case, using message queuing or similar.


Nov 23, 2012 at 3:36 AM

thanks a lot !