Memcache as a queue

I am trying to use memcache as a queue. The functionality works fine in a browser - I can pop items onto the queue and take them off again without any issues - all behaves as expected.

The problem comes when I want to pop items on using memcache from a console (command) process and then access them in the web application - its as though the items are in different caches even though they are both pointed at the same one. Is there something that restricts cache items from one process being used in another process?

Any help would be appreciated. I have tried this with a local memcache and also with Amazon Elaticache with similar results.

This is a yii specific thing and is easily fixable (when you know).

Yii creates a unique cache item ID using an application id that it generates and the item key. You can easily override the application key and then these cross process things will work fine. This drove me nuts for weeks - eventually I had to look at the yii code to figure it out.

In your config add the following :


            'keyPrefix'=>some name,



in the same array as




            'class'=>'system.caching.CMemCache',



and you will be able to access items created by one machine on another.