Answers.Body: <p>You put your Redis connection information in your <code>craft/config/rediscache.php</code> config file.  You can see the default <a href="https://github.com/pixelandtonic/Craft-Release/blob/master/app/etc/config/defaults/rediscache.php" rel="nofollow">here</a>, and your file will override any matching set keys.</p>
  
  <p>From there you can use <code>craft()-&gt;cache-&gt;set()</code>, <code>craft()-&gt;cache-&gt;get()</code> and any other cache methods on Yii's <a href="https://github.com/pixelandtonic/Craft-Release/blob/master/app/framework/caching/CCache.php" rel="nofollow">CCache</a> class.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-29T06:25:22.923Z
Answers.Text: I should've known...! Don't know what I'd do without you sometimes. Thanks, Brad!
Answers.UserDisplayName: taylor
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-29T06:03:45.890Z
Answers.LastActivityDate: 2015-11-29T07:12:58.937Z
Answers.LastEditDate: 2015-11-29T07:12:58.937Z
Answers.UserDisplayName: Brad Bell
Body: <p>How would I access the available <code>RedisCache</code> class and it's properties/methods in PHP/plugins? (<a href="https://buildwithcraft.com/classreference/etc/cache/RedisCache" rel="nofollow">https://buildwithcraft.com/classreference/etc/cache/RedisCache</a>)</p>
  
  <p>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 <a href="http://buildwithcraft.com/docs/config-settings#cacheMethod" rel="nofollow">cacheMethod</a> to <code>redis</code>, and created a <code>rediscache.php</code> file in <code>craft/config/</code>.</p>
  
  <p>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:</p>
  
  <pre><code>echo craft()-&gt;redisCache-&gt;hostname; 
  </code></pre>
  
  <p>But that returns <code>CExeption</code> errors. What am I missing?</p>
  
Tags: <plugin-development><cache><php>
Title: Using RedisCache Class & Methods
ThreadText: # Using RedisCache Class & Methods
  
  (Asked by: username_0 on 2015-11-29)
  
  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](http://buildwithcraft.com/docs/config-settings#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?
  
  **Tags:** plugin-development, cache, php
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-11-29. Score: 1 | Accepted answer
  
  You put your Redis connection information in your `craft/config/rediscache.php` config file. You can see the default [here](https://github.com/pixelandtonic/Craft-Release/blob/master/app/etc/config/defaults/rediscache.php), 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](https://github.com/pixelandtonic/Craft-Release/blob/master/app/framework/caching/CCache.php) class.
  
  > **Comments:**
  > **username_0**: I should've known...! Don't know what I'd do without you sometimes. Thanks, username_1!  
  
  ---
  
  