Example usage for com.squareup.okhttp Cache close

List of usage examples for com.squareup.okhttp Cache close

Introduction

In this page you can find the example usage for com.squareup.okhttp Cache close.

Prototype

public void close() throws IOException 

Source Link

Usage

From source file:com.example.ivy.picassodemo.MyOkHttpDownloader.java

License:Apache License

@Override
public void shutdown() {
    com.squareup.okhttp.Cache cache = client.getCache();
    if (cache != null) {
        try {/* w  w w .jav  a 2s. c  o m*/
            cache.close();
        } catch (IOException ignored) {
        }
    }
}

From source file:com.squareup.picasso252.OkHttpDownloader.java

License:Apache License

@Override
public void shutdown() {
    if (!sharedClient) {
        com.squareup.okhttp.Cache cache = client.getCache();
        if (cache != null) {
            try {
                cache.close();
            } catch (IOException ignored) {
            }// w  w w . j a  va2  s  .c o  m
        }
    }
}

From source file:de.dev.eth0.rssreader.app.http.HttpLoaderImpl.java

License:Apache License

/**
 * Call this to reset the cache-size/*from   w  ww. ja  v a  2  s  . c o m*/
 *
 * @param context
 */
public static void updateCacheSize(Context context) {
    try {
        HttpLoaderImpl fl = getInstance(context);
        Cache cache = fl.client.getCache();
        if (cache != null) {
            cache.flush();
            cache.close();
            cache.delete();
        }
        fl.client.setCache(getCache(context));
    } catch (IOException ex) {
        Timber.w(ex, "Could not update Cachesize");
    }
}