How would I access the available RedisCache class and it's properties/methods in PHP/plugins? (https://buildwithcraft.com/classreference/etc/cache/RedisCache)

I'm just starting to learn Redis and can't seem to find more information about how to start using the available class. I have set cacheMethod to redis, and created a rediscache.php file in craft/config/.

I want to explore connecting to db, inserting my own keys/values and retrieving data for my other plugins, but can't seem to find the right path path. I tried things like:

echo craft()->redisCache->hostname; 

But that returns CExeption errors. What am I missing?

1 Answer 1


You put your Redis connection information in your craft/config/rediscache.php config file. You can see the default here, and your file will override any matching set keys.

From there you can use craft()->cache->set(), craft()->cache->get() and any other cache methods on Yii's CCache class.

  • I should've known...! Don't know what I'd do without you sometimes. Thanks, Brad!
    – taylor
    Nov 29, 2015 at 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.