REDIS - set up error?


(James) #1

Hi,

 

I've just changed from memcached to redis.  Unless I'm logged in to the matrix admin backend I get this error?  Also get it when serving up same pages as https. If I change back to memcached all works as expected.  Any help appreciated.

 

Fatal error: Cannot use object of type Redis as array in /var/www/matrix/core/assets/system/cache_storage/cache_storage_types/cache_storage_redis/cache_storage_redis.inc on line 200 Call Stack: 0.0001 629808 1. {main}() /var/www/matrix/core/web/index.php:0 0.0289 5157096 2. MySource->start() /var/www/matrix/core/web/index.php:30 0.0755 6139024 3. MySource->_sendHTTPHeaders() /var/www/matrix/core/include/mysource.inc:852 0.0808 6182736 4. Asset->printFrontend() /var/www/matrix/core/include/mysource.inc:966 0.0808 6182736 5. Asset->printFrontendAsset() /var/www/matrix/core/include/asset.inc:4809 0.0889 6788104 6. Design_Customisation->paint() /var/www/matrix/core/include/asset.inc:4891 0.0939 6790624 7. Design->paint() /var/www/matrix/core/assets/designs/design_customisation/design_customisation.inc:490 0.0956 6793744 8. require('/var/www/matrix/data/private/assets/design_customisation/0009/2403/design_file.php') /var/www/matrix/core/assets/designs/design/design.inc:1039 0.1077 6991960 9. Page_Standard->printBody() /var/www/matrix/data/private/assets/design_customisation/0009/2403/design_file.php:180 0.1282 7746288 10. Cache_Manager->saveToCache() /var/www/matrix/core/assets/page_templates/page_standard/page_standard.inc:232 0.1331 7746904 11. Cache_Storage_Redis->store() /var/www/matrix/core/assets/system/cache_manager/cache_manager.inc:251

 

Thanks


(James) #2

Now upgraded to 4.18.0 but still get this error unless logged in.  Any idea what's wrong?  I'm guessing I've misconfigured REDIS or something like that?  Anyone got an example of the REDIS config files?

 

Fatal error: Cannot use object of type Redis as array in /var/www/matrix/core/assets/system/cache_storage/cache_storage_types/cache_storage_redis/cache_storage_redis.inc on line 200 Call Stack: 0.0001 629888 1. {main}() /var/www/matrix/core/web/index.php:0 0.0213 5166560 2. MySource->start() /var/www/matrix/core/web/index.php:30 0.0920 6150112 3. MySource->_sendHTTPHeaders() /var/www/matrix/core/include/mysource.inc:852 0.0973 6193824 4. Asset->printFrontend() /var/www/matrix/core/include/mysource.inc:966 0.0973 6193824 5. Asset->printFrontendAsset() /var/www/matrix/core/include/asset.inc:4809 0.1045 6799384 6. Design_Customisation->paint() /var/www/matrix/core/include/asset.inc:4891 0.1092 6801904 7. Design->paint() /var/www/matrix/core/assets/designs/design_customisation/design_customisation.inc:490 0.1109 6805024 8. require('/var/www/matrix/data/private/assets/design_customisation/0015/3570/design_file.php') /var/www/matrix/core/assets/designs/design/design.inc:1039 0.1222 7003248 9. Page_Standard->printBody() /var/www/matrix/data/private/assets/design_customisation/0015/3570/design_file.php:180 0.1416 7757336 10. Cache_Manager->saveToCache() /var/www/matrix/core/assets/page_templates/page_standard/page_standard.inc:232 0.1463 7757968 11. Cache_Storage_Redis->store() /var/www/matrix/core/assets/system/cache_manager/cache_manager.inc:251


(James) #3

REDIS.inc config:

 

<?php // Hosts are tried in order, first successful connection wins!
$redis = Array(
       'hosts' =>Array (
               'redis1' => Array(
                       'socket' => false,
                       'host'   => 'localhost',
                       'port'  => 6379
               )
       ),

       // List of Matrix services utilising the above servers.
       // Indexed by key => weight.
       'services'  => Array(
               'cache_manager'     => Array('redis1' => 1),
       ),
);

return $redis;
?>


(Hamish Forbes) #4

Hi Froddy,

 

I'm almost certain this is bug #6618 http://bugs.matrix.squiz.net/view_bug.php?bug_id=6618

Which was introduced in 4.18.0 and resolved in 4.18.1.

 

If you don't want to do a full upgrade you can patch in the fix to core/assets/system/cache_storage/cache_storage_types/cache_storage_redis/cache_storage_redis.inc

Line 192 Should read 
$ret = $this->_redis->sadd(SQ_CACHE_REDIS_URL_INDEX_PREFIX.$index_url, $mcache_key)
not 
$this->_redis->sadd(SQ_CACHE_REDIS_URL_INDEX_PREFIX.$index_url, $mcache_key)

Hope that helps!

 
Thanks
Hamish

(James) #5

Much appreciated that did the trick!

 

Cheers :)