title: How to configure the Http Cache when using Volley with OkHttp?
body: <p>I want to try Volley combining with OkHttp but Volley cache system and OkHttp both rely on the HTTP cache as defined in the HTTP specification. So how can be disabled the cache of OkHttp for keeping one copy of HTTP cache?</p>
  
  <p><strong>EDIT: what I have done</strong></p>
  
  <pre><code>public class VolleyUtil {
      // http://arnab.ch/blog/2013/08/asynchronous-http-requests-in-android-using-volley/
      private volatile static RequestQueue sRequestQueue;
  
      /** get the single instance of RequestQueue **/
      public static RequestQueue getQueue(Context context) {
          if (sRequestQueue == null) {
              synchronized (VolleyUtil.class) {
                  if (sRequestQueue == null) {
                      OkHttpClient client = new OkHttpClient();
                      client.networkInterceptors().add(new StethoInterceptor());
                      client.setCache(null);
                      sRequestQueue = Volley.newRequestQueue(context.getApplicationContext(), new OkHttpStack(client));
                      VolleyLog.DEBUG = true;
                  }
              }
          }
          return sRequestQueue;
      }
  }
  </code></pre>
  
  <p>Which <code>OkHttpClient</code> is referenced from <a href="https://gist.github.com/bryanstern/4e8f1cb5a8e14c202750" rel="nofollow noreferrer">https://gist.github.com/bryanstern/4e8f1cb5a8e14c202750</a></p>