com.android.volley.Request.shouldCache()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(84)

本文整理了Java中com.android.volley.Request.shouldCache方法的一些代码示例,展示了Request.shouldCache的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.shouldCache方法的具体详情如下:
包路径:com.android.volley.Request
类名称:Request
方法名:shouldCache

Request.shouldCache介绍

[英]Returns true if responses to this request should be cached.
[中]如果应该缓存对此请求的响应,则返回true。

代码示例

代码示例来源:origin: chentao0707/SimplifyReader

if (request.shouldCache()) {
  synchronized (mWaitingRequests) {
    String cacheKey = request.getCacheKey();

代码示例来源:origin: mcxiaoke/android-volley

if (request.shouldCache()) {
  synchronized (mWaitingRequests) {
    String cacheKey = request.getCacheKey();

代码示例来源:origin: jiangqqlmj/FastDev4Android

if (request.shouldCache()) {
  synchronized (mWaitingRequests) {
    String cacheKey = request.getCacheKey();

代码示例来源:origin: chentao0707/SimplifyReader

if (!request.shouldCache()) {
  mNetworkQueue.add(request);
  return request;

代码示例来源:origin: mcxiaoke/android-volley

if (!request.shouldCache()) {
  mNetworkQueue.add(request);
  return request;

代码示例来源:origin: jiangqqlmj/FastDev4Android

if (!request.shouldCache()) {
  mNetworkQueue.add(request);
  return request;

代码示例来源:origin: chentao0707/SimplifyReader

if (request.shouldCache() && response.cacheEntry != null) {
  mCache.put(request.getCacheKey(), response.cacheEntry);
  request.addMarker("network-cache-written");

代码示例来源:origin: mcxiaoke/android-volley

if (request.shouldCache() && response.cacheEntry != null) {
  mCache.put(request.getCacheKey(), response.cacheEntry);
  request.addMarker("network-cache-written");

代码示例来源:origin: jiangqqlmj/FastDev4Android

if (request.shouldCache() && response.cacheEntry != null) {
  mCache.put(request.getCacheKey(), response.cacheEntry);
  request.addMarker("network-cache-written");

代码示例来源:origin: xuningjack/AndroidNet

/**
   * Called from {@link Request#finish(String)}, indicating that processing of the given request
   * has finished.
   *
   * <p>Releases waiting requests for <code>request.getCacheKey()</code> if
   *      <code>request.shouldCache()</code>.</p>
   */
  void finish(Request<?> request) {
    // Remove from the set of requests currently being processed.
    synchronized (mCurrentRequests) {
      mCurrentRequests.remove(request);
    }

    if (request.shouldCache()) {
      synchronized (mWaitingRequests) {
        String cacheKey = request.getCacheKey();
        Queue<Request<?>> waitingRequests = mWaitingRequests.remove(cacheKey);
        if (waitingRequests != null) {
          if (VolleyLog.DEBUG) {
            VolleyLog.v("Releasing %d waiting requests for cacheKey=%s.",
                waitingRequests.size(), cacheKey);
          }
          // Process all queued up requests. They won't be considered as in flight, but
          // that's not a problem as the cache has been primed by 'request'.
          mCacheQueue.addAll(waitingRequests);
        }
      }
    }
  }
}

代码示例来源:origin: MewX/light-novel-library_Wenku8_Android

if (request.shouldCache()) {
  synchronized (mWaitingRequests) {
    String cacheKey = request.getCacheKey();

代码示例来源:origin: jungletian/TitanjumNote

if (request.shouldCache()) {
  synchronized (mWaitingRequests) {
    String cacheKey = request.getCacheKey();

代码示例来源:origin: com.mcxiaoke.volley/library

if (request.shouldCache()) {
  synchronized (mWaitingRequests) {
    String cacheKey = request.getCacheKey();

代码示例来源:origin: AnandChowdhary/saga-android

if (request.shouldCache()) {
  synchronized (mWaitingRequests) {
    String cacheKey = request.getCacheKey();

代码示例来源:origin: chuyangliu/tastysnake

if (request.shouldCache()) {
  synchronized (mWaitingRequests) {
    String cacheKey = request.getCacheKey();

代码示例来源:origin: tazimete/android-app-food-delivery-system

if (request.shouldCache()) {
  synchronized (mWaitingRequests) {
    String cacheKey = request.getCacheKey();

代码示例来源:origin: panxw/android-volley-manager

if (request.shouldCache()) {
  synchronized (mWaitingRequests) {
    String cacheKey = request.getCacheKey();

代码示例来源:origin: tazimete/android-app-food-delivery-system

if (request.shouldCache()) {
  synchronized (mWaitingRequests) {
    String cacheKey = request.getCacheKey();

代码示例来源:origin: cat9/EasyVolley

if (request.shouldCache()) {
  synchronized (mWaitingRequests) {
    String cacheKey = request.getCacheKey();

代码示例来源:origin: com.mcxiaoke.volley/library

if (!request.shouldCache()) {
  mNetworkQueue.add(request);
  return request;

相关文章

微信公众号

最新文章

更多