Java 类com.android.volley.toolbox.DiskBasedCache 实例源码

项目:CursoAndroid    文件:ApiClient.java   
public RequestQueue getRequestQueue() {
    if (mRequestQueue == null) {

        // Instantiate the cache
        Cache cache = new DiskBasedCache(mContext.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);
        // Start the queue
        mRequestQueue.start();

        // getApplicationContext() is key, it keeps you from leaking the
        // Activity or BroadcastReceiver if someone passes one in.
        //mRequestQueue = Volley.newRequestQueue(mContext.getApplicationContext());
    }
    return mRequestQueue;
}
项目:Goalie_Android    文件:BaseTest.java   
private RequestQueue newVolleyRequestQueueForTest(final Context context) {
    File cacheDir = new File(context.getCacheDir(), "cache/volley");
    Network network = new BasicNetwork(new HurlStack());
    ResponseDelivery responseDelivery = new ExecutorDelivery(Executors.newSingleThreadExecutor());
    RequestQueue queue = new RequestQueue(new DiskBasedCache(cacheDir), network, 4, responseDelivery);
    queue.start();

    return queue;
}
项目:shutterstock-image-browser    文件:VolleySingleton.java   
/**
 * Creates a new Request Queue which caches to the external storage directory
 * @param context
 * @return
 */
private static RequestQueue newRequestQueue(Context context) {
    // define cache folder
    File rootCache = context.getExternalCacheDir();
    if (rootCache == null) {
        Log.w(TAG, "Can't find External Cache Dir, "
                + "switching to application specific cache directory");
        rootCache = context.getCacheDir();
    }

    File cacheDir = new File(rootCache, DEFAULT_CACHE_DIR);
    cacheDir.mkdirs();

    HttpStack stack = new HurlStack();
    Network network = new BasicNetwork(stack);
    DiskBasedCache diskBasedCache = new DiskBasedCache(cacheDir, DEFAULT_DISK_USAGE_BYTES);
    RequestQueue queue = new RequestQueue(diskBasedCache, network);
    queue.start();

    return queue;
}
项目:android-project-template    文件:DrupalModel.java   
/**
 * volley's default implementation uses internal cache only so we've implemented our, allowing
 * external cache usage.
 */
@NonNull
private static RequestQueue newRequestQueue(@NonNull final Context context,
        @Nullable HttpStack stack) {

    final VolleyHelperFactory.IVolleyHelper helper = VolleyHelperFactory.newHelper();
    final File cacheDir = helper.getBestCacheDir(context);

    if (stack == null) {
        stack = helper.createHttpStack(context);
    }

    final Network network = new BasicNetwork(stack);
    final RequestQueue queue = new RequestQueue(
            new DiskBasedCache(cacheDir, ApplicationConfig.CACHE_DISK_USAGE_BYTES), network, 1);
    queue.start();
    return queue;
}
项目:android-project-template    文件:Model.java   
/**
 * volley's default implementation uses internal cache only so we've implemented our, allowing
 * external cache usage.
 */
private static RequestQueue newRequestQueue(@NonNull final Context context,
        @Nullable HttpStack stack) {

    final VolleyHelperFactory.IVolleyHelper helper = VolleyHelperFactory.newHelper();
    final File cacheDir = helper.getBestCacheDir(context);

    if (stack == null) {
        stack = helper.createHttpStack(context);
    }

    final Network network = new BasicNetwork(stack);
    final RequestQueue queue = new RequestQueue(
            new DiskBasedCache(cacheDir, ApplicationConfig.CACHE_DISK_USAGE_BYTES), network, 1);
    queue.start();
    return queue;
}
项目:Wardrobe_app    文件:ImageLoader.java   
private static RequestQueue newRequestQueue(Context context) {

        // On HC+ use HurlStack which is based on HttpURLConnection. Otherwise fall back on
        // AndroidHttpClient (based on Apache DefaultHttpClient) which should no longer be used
        // on newer platform versions where HttpURLConnection is simply better.
        Network network = new BasicNetwork(
                UIUtils.hasHoneycomb() ?
                        new HurlStack() :
                        new HttpClientStack(AndroidHttpClient.newInstance(
                                NetUtils.getUserAgent(context))));

        Cache cache = new DiskBasedCache(getDiskCacheDir(context, CACHE_DIR));
        RequestQueue queue = new RequestQueue(cache, network);
        queue.start();
        return queue;
    }
项目:io2014-codelabs    文件:CloudBackendFragment.java   
private RequestQueue newRequestQueue(Context context) {
    // define cache folder
    File rootCache = context.getExternalCacheDir();
    if (rootCache == null) {
        rootCache = context.getCacheDir();
    }

    File cacheDir = new File(rootCache, DEFAULT_CACHE_DIR);
    cacheDir.mkdirs();

    HttpStack stack = new HurlStack();
    Network network = new BasicNetwork(stack);
    DiskBasedCache diskBasedCache = new DiskBasedCache(cacheDir, DEFAULT_DISK_USAGE_BYTES);
    RequestQueue queue = new RequestQueue(diskBasedCache, network);
    queue.start();

    return queue;
}
项目:MangaJunkie-Android    文件:App.java   
@Override
public void onCreate() {
    super.onCreate();

    PREFS = new PreferenceWrapper( this );
    PREFS.listen();

    DISK_CACHE = new DiskBasedCache( getExternalCacheDir(), DISK_CACHE_SIZE );
    MEMORY_CACHE = new MangaMemoryCache();

    // Use the same disk cache for main and background download queues
    REQUEST_QUEUE = new RequestQueue( DISK_CACHE, new BasicNetwork( new HurlStack() ));
    REQUEST_QUEUE.start();

    // Use a custom in-memory LruCache for the loader
    IMAGE_LOADER = new ImageLoader( REQUEST_QUEUE, MEMORY_CACHE );

    // Setup databases
    Library.setDB( LibraryDatabaseHelper.getInstance( this ).getWritableDatabase() );
    Collection.setDB( CollectionDatabaseHelper.getInstance( this ).getWritableDatabase() );

    MangaUpdateReceiver.startUpdateCycle( this );
}
项目:Volley-Ball    文件:VolleyBallConfig.java   
public VolleyBallConfig build() {
    if (mInstance.mHttpStack == null) {
        mInstance.mHttpStack = ConfigUtils.getDefaultHttpStack(mInstance.mContext);
    }

    if (mInstance.mNetwork == null) {
        mInstance.mNetwork = ConfigUtils.getDefaultNetwork(mInstance.mHttpStack);
    }

    if (mInstance.mCache == null) {
        File cacheDir = new File(mInstance.mContext.getCacheDir(), DEFAULT_CACHE_DIR);
        mInstance.mCache = new DiskBasedCache(cacheDir);
    }

    return mInstance;
}
项目:iosched2013    文件:ImageLoader.java   
private static RequestQueue newRequestQueue(Context context) {

        // On HC+ use HurlStack which is based on HttpURLConnection. Otherwise fall back on
        // AndroidHttpClient (based on Apache DefaultHttpClient) which should no longer be used
        // on newer platform versions where HttpURLConnection is simply better.
        Network network = new BasicNetwork(
                UIUtils.hasHoneycomb() ?
                        new HurlStack() :
                        new HttpClientStack(AndroidHttpClient.newInstance(
                                NetUtils.getUserAgent(context))));

        Cache cache = new DiskBasedCache(getDiskCacheDir(context, CACHE_DIR));
        RequestQueue queue = new RequestQueue(cache, network);
        queue.start();
        return queue;
    }
项目:Qmusic    文件:QMusicRequestManager.java   
/**
 * Use a custom L2 cache,support LRU
 * 
 * @param context
 * @param uniqueName
 * @param diskCacheSize
 * @param memCacheSize
 * @param compressFormat
 * @param quality
 * @param type
 */
private QMusicRequestManager(final Context context, final int diskCacheSize, final int memCacheSize) {
    // ============L2 Cache=============
    HttpStack stack = getHttpStack(false);
    Network network = new BasicNetwork(stack);
    if (L2CacheType == 0) {
        // TODO: this L2 cache implement ignores the HTTP cache headers
        mCacheL2 = new VolleyL2DiskLruCache(new File(context.getCacheDir(), "L2-Cache"), diskCacheSize);
    } else {
        // The build-in L2 cache has no LRU
        mCacheL2 = new DiskBasedCache(new File(context.getCacheDir(), "L2-Cache"), diskCacheSize);
    }
    mRequestQueue = new RequestQueue(mCacheL2, network);
    mRequestQueue.start();
    // ============L1 Cache=============
    if (L1CacheType == 0) {
        mCacheL1 = new VolleyL1MemoryLruImageCache(memCacheSize);
    } else {
        mCacheL1 = new VolleyL1DiskLruImageCache(context, "L1-Cache", diskCacheSize, CompressFormat.JPEG, 80);
    }
    mImageLoader = new ImageLoader(mRequestQueue, mCacheL1);
}
项目:super-volley    文件:SuperVolley.java   
/**
 * Initialize {@link SuperVolley} with a disk base cache
 *
 * @param context      Application context to get access to the applications cache directory
 * @param cacheDirName The name of {@link SuperVolley}'s cache directory
 */
public Builder cache(Context context, String cacheDirName) {
    final File cacheDirPath = context.getCacheDir();
    final File cacheDir = new File(cacheDirPath, cacheDirName);
    cache(new DiskBasedCache(cacheDir));
    return this;
}
项目:plainrequest    文件:PlainRequestQueue.java   
/**
 * Inicia uma instancia da lib PlainRequest
 * utilizando cache do volley
 *
 * @param app
 * @param sizeCache // tamanho do cache em MB
 */
public void start(Application app, int sizeCache) {
    if(context == null) {
        context = app.getApplicationContext();
        // Cache
        Cache cache = new DiskBasedCache(app.getCacheDir(), (1024 * 1024) * sizeCache);
        Network network = new BasicNetwork(new HurlStack());
        queue = new RequestQueue(cache, network); // Criação do RequestQueue
    }
}
项目:malp    文件:HTTPAlbumImageProvider.java   
private HTTPAlbumImageProvider(Context context) {
    // Don't use MALPRequestQueue because we do not need to limit the load on the local server
    Network network = new BasicNetwork(new HurlStack());
    // 10MB disk cache
    Cache cache = new DiskBasedCache(context.getCacheDir(), 1024 * 1024 * 10);

    mRequestQueue = new RequestQueue(cache, network);
    mRequestQueue.start();
}
项目:malp    文件:MALPRequestQueue.java   
public synchronized static MALPRequestQueue getInstance(Context context) {
    if ( null == mInstance ) {
        Network network = new BasicNetwork(new HurlStack());
        // 10MB disk cache
        Cache cache = new DiskBasedCache(context.getCacheDir(), 1024 * 1024 * 10);

        mInstance = new MALPRequestQueue(cache,network);
        mInstance.start();
    }
    return mInstance;
}
项目:NetRequest    文件:VolleyManagerNew.java   
private void initRequestQueue(@NonNull Context context) {
    if (mRequestQueue != null) {
        return;
    }
    Network network = new BasicNetwork(new OkHttpStack());
    File cacheDir = new File(context.getCacheDir(), DEFAULT_CACHE_DIR);
    mRequestQueue = new RequestQueue(new DiskBasedCache(cacheDir), network, DEFAULT_NETWORK_THREAD_POOL_SIZE);
    mRequestQueue.start();
}
项目:NetRequest    文件:VolleyManager.java   
private void initRequestQueue(@NonNull Context context) {
    if (mRequestQueue != null) {
        return;
    }
    Network network = new BasicNetwork(new OkHttpStack());
    File cacheDir = new File(context.getCacheDir(), DEFAULT_CACHE_DIR);
    mRequestQueue = new RequestQueue(new DiskBasedCache(cacheDir), network, DEFAULT_NETWORK_THREAD_POOL_SIZE);
    mRequestQueue.start();
}
项目:VolleyImageLoader    文件:CustomVolleyRequestQueue.java   
public RequestQueue getRequestQueue() {
    if (mRequestQueue == null) {
        Cache cache = new DiskBasedCache(mCtx.getCacheDir(), 10 * 1024 * 1024);
        Network network = new BasicNetwork(new HurlStack());
        mRequestQueue = new RequestQueue(cache, network);
        // Don't forget to start the volley request queue
        mRequestQueue.start();
    }
    return mRequestQueue;
}
项目:VolleyBecomesEasy    文件:CustomVolleyRequestQueue.java   
public RequestQueue getRequestQueue() {
    if (requestQueue == null) {
        Cache cache = new DiskBasedCache(ctx.getCacheDir(), 10 * 1024 * 1024);
        Network network = new BasicNetwork(new HurlStack());
        requestQueue = new RequestQueue(cache, network);
        // Don't forget to start the volley request queue
        requestQueue.start();
    }
    return requestQueue;
}
项目:VolleyExample    文件:CustomVolleyRequestQueue.java   
public RequestQueue getRequestQueue() {
    if (mRequestQueue == null) {
        Cache cache = new DiskBasedCache(mCtx.getCacheDir(), 10 * 1024 * 1024);
        Network network = new BasicNetwork(new HurlStack());
        mRequestQueue = new RequestQueue(cache, network);
        // Don't forget to start the volley request queue
        mRequestQueue.start();
    }
    return mRequestQueue;
}
项目:HappyVolley    文件:HappyRequestQueue.java   
/**
 * 自定义Volley请求Queue
 *
 * @param context Context
 * @return RequestQueue
 */
public RequestQueue newRequestQueue(Context context) {
    File cacheDir = new File(context.getCacheDir(), DEFAULT_CACHE_DIR);
    Network network = new BasicNetwork(new HurlStack());
    RequestQueue queue = new RequestQueue(new DiskBasedCache(cacheDir),
            network,
            DEFAULT_NETWORK_THREAD_POOL_SIZE,
            new ExecutorDelivery(executorService));
    queue.start();
    return queue;
}
项目:Airbnb-Android-Google-Map-View    文件:CustomVolleyRequestQueue.java   
public RequestQueue getRequestQueue() {
    if (mRequestQueue == null) {
        Cache cache = new DiskBasedCache(mCtx.getCacheDir(), 10 * 1024 * 1024);
        Network network = new BasicNetwork(new HurlStack());
        mRequestQueue = new RequestQueue(cache, network);
        // Don't forget to start the volley request queue
        mRequestQueue.start();
    }
    return mRequestQueue;
}
项目:odyssey    文件:LimitingRequestQueue.java   
public synchronized static LimitingRequestQueue getInstance(Context context) {
    if ( null == mInstance ) {
        Network network = new BasicNetwork(new HurlStack());
        // 10MB disk cache
        Cache cache = new DiskBasedCache(context.getCacheDir(), 1024 * 1024 * 10);

        mInstance = new LimitingRequestQueue(cache,network);
        mInstance.start();
    }
    return mInstance;
}
项目:BigApp_WordPress_Android    文件:DataManager.java   
public static boolean clearUserInfo(Context context) {
    File file_collect = new DiskBasedCache(SdCacheTools.getOwnVolleyCacheDir(context)).getFileForKey(RequestUrl.my_collect + "&filter[pre_page]=" + 10 + "&page=" + 1);
    File file_commit = new DiskBasedCache(SdCacheTools.getOwnVolleyCacheDir(context)).getFileForKey(RequestUrl.my_commit + "&filter[pre_page]=" + 10 + "&page=" + 1);
    Log.e("", "wenjun logout clearUserInfo collect file length = " + (file_collect == null ? 0 : file_collect.length()) + "&  commitfile length = " + (file_commit == null ? 0 : file_commit.length()));
    file_collect.delete();
    file_commit.delete();
    return true;
}
项目:PGMacTips    文件:VolleyCalls.java   
public static void setupCache(Context context){
    // Instantiate the cache
    Cache cache = new DiskBasedCache(context.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.
    RequestQueue mRequestQueue;
    mRequestQueue = new RequestQueue(cache, network);

    // Start the queue
    mRequestQueue.start();

    String url ="http://www.example.com";

    // Formulate the request and handle the response.
    StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
            new Response.Listener<String>() {
                @Override
                public void onResponse(String response) {
                    // Do something with the response
                }
            },
            new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    // Handle error
                }
            });

    // Add the request to the RequestQueue.
    mRequestQueue.add(stringRequest);
}
项目:guokr-android    文件:NetworkModelImpl.java   
public NetworkModelImpl() {
    bitmapCache = new LruBitmapCache();

    Cache cache = new DiskBasedCache(App.getContext().getCacheDir(), 10 * 1024 * 1024);
    Network network = new BasicNetwork(new HurlStack());
    requestQueue = new RequestQueue(cache, network);
    requestQueue.start();
}
项目:FMTech    文件:WalletRequestQueue.java   
public static RequestQueue getApiRequestQueue(Context paramContext)
{
  try
  {
    if (sInstance == null)
    {
      RequestQueue localRequestQueue1 = new RequestQueue(new DiskBasedCache(new File(paramContext.getCacheDir(), "wallet_im_volley_api_cache"), 1048576), createNetwork(paramContext), 2);
      sInstance = localRequestQueue1;
      localRequestQueue1.start();
    }
    RequestQueue localRequestQueue2 = sInstance;
    return localRequestQueue2;
  }
  finally {}
}
项目:FMTech    文件:WalletRequestQueue.java   
public static RequestQueue getImageRequestQueue(Context paramContext)
{
  try
  {
    if (sImageInstance == null)
    {
      RequestQueue localRequestQueue1 = new RequestQueue(new DiskBasedCache(new File(paramContext.getCacheDir(), "wallet_im_volley_image_cache"), ((Integer)G.images.diskCacheSizeBytes.get()).intValue()), createNetwork(paramContext), 6);
      sImageInstance = localRequestQueue1;
      localRequestQueue1.start();
    }
    RequestQueue localRequestQueue2 = sImageInstance;
    return localRequestQueue2;
  }
  finally {}
}
项目:shr    文件:SApplication.java   
private RequestManager initRequestManager() {
  RequestManager requestManager = new RequestManager(this, appFolderName);
  String diskHTTPCacheDir = FileUtil.getAppRootDirectory(appFolderName) +
      "/httpCache";
  RequestQueue requestQueue =
      new RequestQueue(new DiskBasedCache(new File(diskHTTPCacheDir)), new CommonNetwork());
  requestManager.setVolleyRequestQueue(requestQueue);
  return requestManager;
}
项目:hex    文件:HexApplication.java   
public RequestQueue getRequestQueue() {
    if (mRequestQueue == null) {
        int MEGABYTE = 1024 * 1024;
        Cache cache = new DiskBasedCache(getCacheDir(), MEGABYTE);
        Network network = new BasicNetwork(new HurlStack());
        mRequestQueue = new RequestQueue(cache, network);
        mRequestQueue.start();
    }

    return mRequestQueue;
}
项目:fresco    文件:SampleVolleyFactory.java   
public static RequestQueue getRequestQueue(Context context) {
  if (sRequestQueue == null) {
    File cacheDir = new File(context.getCacheDir(), VOLLEY_CACHE_DIR);
    sRequestQueue = new RequestQueue(
        new DiskBasedCache(cacheDir, ConfigConstants.MAX_DISK_CACHE_SIZE),
        new BasicNetwork(new HurlStack()));
    sRequestQueue.start();
  }
  return sRequestQueue;
}
项目:android-discourse    文件:ImageLoader.java   
private static RequestQueue newRequestQueue(Context context) {

        // On HC+ use HurlStack which is based on HttpURLConnection. Otherwise fall back on
        // AndroidHttpClient (based on Apache DefaultHttpClient) which should no longer be used
        // on newer platform versions where HttpURLConnection is simply better.
        Network network = new BasicNetwork(Utils.hasHoneycomb() ? new HurlStack() : new HttpClientStack(AndroidHttpClient.newInstance(Utils.getUserAgent(context))));

        Cache cache = new DiskBasedCache(getDiskCacheDir(context, CACHE_DIR), DEFAULT_DISK_USAGE_BYTES);
        RequestQueue queue = new RequestQueue(cache, network);
        queue.start();
        return queue;
    }
项目:TuChongAndroid    文件:RequestManager.java   
private static Cache openCache() {
    File cacheDir =  BaseApplication.getBaseApplication().getExternalCacheDir();
    if(cacheDir == null || !cacheDir.exists()){
        cacheDir = BaseApplication.getBaseApplication().getCacheDir();
    }
    return new DiskBasedCache(cacheDir, 10 * 1024 * 1024);
}
项目:wasp    文件:WaspTest.java   
public WaspTest() throws Exception {
  File cacheDir = new File(context.getCacheDir(), "volley");
  Network network = new BasicNetwork(new OkHttpStack(new OkHttpClient()));
  ResponseDelivery delivery = new ExecutorDelivery(executor);
  requestQueue = new RequestQueue(new DiskBasedCache(cacheDir), network, 4, delivery);
  requestQueue.start();

  server.start();
}
项目:mdapp    文件:LvhActivity.java   
private void getCategories()
{
    final RequestQueue requestQueue = new RequestQueue(new DiskBasedCache(getCacheDir(), 0), new BasicNetwork(new HurlStack()));

    requestQueue.start();

    JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(mTools.getApiUri()+"api/1/lvh/", new Response.Listener<JSONArray>()
    {
        @Override
        public void onResponse(JSONArray response)
        {
            requestQueue.stop();

            mProgressBar.setVisibility(View.GONE);
            mSwipeRefreshLayout.setRefreshing(false);

            if(mTools.isTablet())
            {
                int spanCount = (response.length() == 1) ? 1 : 2;
                mRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(spanCount, StaggeredGridLayoutManager.VERTICAL));
            }

            mRecyclerView.setAdapter(new LvhAdapter(response));
        }
    }, new Response.ErrorListener()
    {
        @Override
        public void onErrorResponse(VolleyError error)
        {
            requestQueue.stop();

            Log.e("LvhActivity", error.toString());
        }
    });

    jsonArrayRequest.setRetryPolicy(new DefaultRetryPolicy(10000, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));

    requestQueue.add(jsonArrayRequest);
}
项目:Orpheus    文件:ArtworkModule.java   
@Provides @Singleton
public RequestQueue provideRequestQueue(@ForApplication Context context) {
    final int poolSize = MusicApp.isLowEndHardware(context) ? VOLLEY_POOL_SIZE_SMALL : VOLLEY_POOL_SIZE;
    RequestQueue queue = new RequestQueue(
            new DiskBasedCache(CacheUtil.getCacheDir(context, VOLLEY_CACHE_DIR), VOLLEY_CACHE_SIZE),
            new BasicNetwork(new HurlStack()),
            poolSize
    );
    queue.start();
    return queue;
}
项目:android_tv_metro    文件:VolleyTestMainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.test_main);

    txtDisplay = (TextView) findViewById(R.id.txtDisplay);

    // Instantiate the cache
    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);
    // Start the queue
    mRequestQueue.start();

    String url = "http://172.27.9.104:9300/testdata/1/1/1/zh/CN?api=index";

    JsonObjectRequest jsObjRequest = new JsonObjectRequest(Request.Method.GET, url, null,
            new Response.Listener<JSONObject>() {

                @Override
                public void onResponse(JSONObject response) {
                    // TODO Auto-generated method stub
                    txtDisplay.setText("Response => " + response.toString());
                    findViewById(R.id.progressBar1).setVisibility(View.GONE);
                }
            }, new Response.ErrorListener() {

                @Override
                public void onErrorResponse(VolleyError error) {
                    txtDisplay.setText("VolleyError => " + error.toString());
                    findViewById(R.id.progressBar1).setVisibility(View.GONE);
                }
            });

    mRequestQueue.add(jsObjRequest);

}
项目:Rando-android    文件:VolleySingleton.java   
private RequestQueue createRequestQueue(Context context) {
    if (context == null) {
        return null;
    }

    File cacheDir = new File(context.getCacheDir(), DEFAULT_CACHE_DIR);
    Network network = new BasicNetwork(new HurlStack());
    RequestQueue queue = new RequestQueue(new DiskBasedCache(cacheDir, DEFAULT_CACHE_SIZE), network);
    queue.start();
    return queue;
}
项目:Qmusic    文件:QMusicRequestManager.java   
/**
 * CacheType
 */
public void clearCache(CacheType cacheType) {
    if (cacheType == CacheType.MEMORY) {
        if (mCacheL1 instanceof DiskBasedCache) {
            ((DiskBasedCache) mCacheL1).clear();
        } else if (mCacheL1 instanceof VolleyL2DiskLruCache) {
            ((VolleyL2DiskLruCache) mCacheL1).clear();
        }
    } else {
        mCacheL2.clear();
    }
}
项目:FrappeSyncAdapter    文件:FrappeNoteApi.java   
private static RequestQueue prepareSerialRequestQueue(Context context) {
    Cache cache = new DiskBasedCache(context.getCacheDir(), MAX_CACHE_SIZE);
    Network network = getNetwork();
    return new RequestQueue(cache, network, MAX_SERIAL_THREAD_POOL_SIZE);
}