title: Mule Caching Strategy using Redis
body: <p>I'm looking for a way to have a shared cache across two servers and I am investigating using Redis as an object-store-caching-strategy but I am encountering a problem when reading stored values.</p>
  
  <p>It successfully stores a value when the cache hit is a miss value but throws an error when retrieving the value. </p>
  
  <blockquote>
    <p>The required object/property "muleContext" is null</p>
  </blockquote>
  
  <p>At a guess it seems like the object-store-caching-strategy might need an object store that implements the MuleContextAware interface. </p>
  
  <p>Does anyone know if this is correct or how to resolve this issue?</p>
  
  <p>Here is the example flow</p>
  
  <pre><code>    &lt;mule xmlns:redis="http://www.mulesoft.org/schema/mule/redis" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
      xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
  http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
  http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
  http://www.mulesoft.org/schema/mule/redis http://www.mulesoft.org/schema/mule/redis/3.4/mule-redis.xsd"&gt;
  
  
      &lt;redis:config name="Redis" doc:name="Redis" defaultPartitionName="test" /&gt;
      &lt;ee:object-store-caching-strategy name="Redis_Caching_Strategy" doc:name="Caching Strategy"&gt;
          &lt;spring-object-store ref="Redis" /&gt;
      &lt;/ee:object-store-caching-strategy&gt;
  
      &lt;flow name="htmlCacheRedisFlow" doc:name="htmlCacheRedisFlow"&gt;
          &lt;http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8084" path="cacheRedis" doc:name="HTTP"/&gt;
          &lt;expression-transformer expression="#[payload.substring(payload.lastIndexOf('/') + 1)]" doc:name="Expression"/&gt;
          &lt;ee:cache doc:name="Cache" cachingStrategy-ref="Redis_Caching_Strategy" &gt;
              &lt;logger message="getting item from db for key #[payload]" level="INFO" doc:name="Logger"/&gt;
              &lt;expression-transformer expression="#[payload + 'asd']" doc:name="Expression"/&gt;
          &lt;/ee:cache&gt;
      &lt;/flow&gt; 
  &lt;/mule&gt;
  </code></pre>