Yii2 XCache module not working

I am struggling with the XCache module of YII 2 Framework. It works on my WAMP server (Windows 7/Apache/2.4.9 PHP/5.5.12) but it doesn’t seem to work on my hosting (Slackware/Apache/2.4.6 (Unix) PHP/5.4.38).

When I test the built-in php xcache functions they seem to work fine.



$key = md5('key-name');

xcache_set($key, 'value');

$cache = xcache_get($key);



string(5) "value"

However, XCache caching library in my Yii2 application does not.

I initialize the caching module in my Yii2 configuration as follows:

'components' => [

        'cache' => [

            'class' => 'yii\caching\XCache',


And i use it in my models as in the following example:

public function getBlogArticles($where = [], $limit = null) {

        $cacheKey = md5('view-articles-where-' . json_encode($where) . '-limit-' . json_encode($limit));

        $articles = Yii::$app->cache->get($cacheKey);

        if ($articles === false) {

            $articles = $this->find()->where($where)->orderBy('date DESC')->limit($limit);

            Yii::$app->cache->set($cacheKey, $articles, 5 * 60);


        return $articles;


My xcache configuration in php.ini is:


xcache.size = 128M

xcache.var_size = 64M

xcache.var_slots = 8K

xcache.mmap_path = "/tmp/xcached/xcached"

xcache.cacher = On

Any ideas?

Any errors? How exactly it doesn’t work?