Android volley 使用Volley类创建RequestCache时如何设置RequestQueue缓存?

Android volley 使用Volley类创建RequestCache时如何设置RequestQueue缓存?,android-volley,Android Volley,我正在singleton类中创建一个RequestQueue,Google提供的示例是通过调用Volley类的newRequestQueue来创建它,该类作为参数仅获取当前应用程序的上下文: mRequestQueue = Volley.newRequestQueue(mCtx.getApplicationContext()); 以前我没有使用singleton类,我在activity OnCreate中创建了一个RequestQueue,代码如下: Cache cache = new Dis

我正在singleton类中创建一个RequestQueue,Google提供的示例是通过调用Volley类的newRequestQueue来创建它,该类作为参数仅获取当前应用程序的上下文:

mRequestQueue = Volley.newRequestQueue(mCtx.getApplicationContext());
以前我没有使用singleton类,我在activity OnCreate中创建了一个RequestQueue,代码如下:

Cache cache = new DiskBasedCache(getCacheDir(), 1024 * 1024); // 1MB cap

// Set up the network to use HttpURLConnection as the HTTP client.
Network network = new BasicNetwork(new HurlStack());

// Instantiate the RequestQueue with the cache and network.
mRequestQueue = new RequestQueue(cache, network);
因为通过这段代码,我设置了网络和缓存,我搜索了Volley类以获得一个合适的newRequestQueue方法,但是我注意到newRequestQueue只有两个重载,一个重载带有我可以用来设置网络的HttpStack参数,但没有重载带有缓存参数

所以问题是:有一种方法可以创建一个请求队列,让Volley类消耗它的缓存