title: Mule Caching Strategy using Mongo DB
body: <p>Is it possible to use the org.mule.module.mongo.MongoObjectStore as a cache strategy within a flow? </p>
  
  <p>I have attempted with the following but I get the error </p>
  
  <blockquote>
    <p>null (java.lang.NullPointerException)<br>
    org.mule.module.mongo.MongoObjectStore:382 (null).</p>
  </blockquote>
  
  <pre><code>&lt;mule xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc" xmlns:mongo="http://www.mulesoft.org/schema/mule/mongo" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.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/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
  http://www.mulesoft.org/schema/mule/ee/jdbc http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.xsd
  http://www.mulesoft.org/schema/mule/mongo http://www.mulesoft.org/schema/mule/mongo/2.0/mule-mongo.xsd"&gt;
  
      &lt;ee:object-store-caching-strategy name="Mongo_Caching_Strategy" doc:name="Caching Strategy"&gt;
          &lt;custom-object-store class="org.mule.module.mongo.MongoObjectStore"&gt;
              &lt;spring:property name="host" value="localhost"/&gt;
              &lt;spring:property name="port" value="27017"/&gt;
              &lt;spring:property name="database" value="test"/&gt;
          &lt;/custom-object-store&gt;
      &lt;/ee:object-store-caching-strategy&gt;
  
      &lt;flow name="htmlCacheFlow" doc:name="htmlCacheFlow"&gt;
          &lt;http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8084" path="cache" 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="Mongo_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>
  
  <p>Could anyone provide an example on how to configure it?</p>