Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for CacheSize (0.32 sec)

  1. samples/guide/src/main/java/okhttp3/recipes/CacheResponse.java

    import okhttp3.Response;
    
    public final class CacheResponse {
      private final OkHttpClient client;
    
      public CacheResponse(File cacheDirectory) throws Exception {
        int cacheSize = 10 * 1024 * 1024; // 10 MiB
        Cache cache = new Cache(cacheDirectory, cacheSize);
    
        client = new OkHttpClient.Builder()
            .cache(cache)
            .build();
      }
    
      public void run() throws Exception {
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun May 22 01:29:42 GMT 2016
    - 2.4K bytes
    - Viewed (0)
  2. android-test/src/androidTest/java/okhttp/android/test/OkHttpTest.kt

        server.enqueue(MockResponse(body = "abc"))
    
        val ctxt = InstrumentationRegistry.getInstrumentation().targetContext.applicationContext
    
        val cacheSize = 1L * 1024 * 1024 // 1MB
        val cache = Cache(ctxt.cacheDir.resolve("testCache"), cacheSize)
    
        try {
          client =
            client.newBuilder()
              .cache(cache)
              .build()
    
          val request =
            Request.Builder()
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 27K bytes
    - Viewed (1)
  3. okhttp/src/main/kotlin/okhttp3/OkHttpClient.kt

     *
     * ```java
     * // The singleton HTTP client.
     * public final OkHttpClient client = new OkHttpClient.Builder()
     *     .addInterceptor(new HttpLoggingInterceptor())
     *     .cache(new Cache(cacheDir, cacheSize))
     *     .build();
     * ```
     *
     * ## Customize Your Client With newBuilder()
     *
     * You can customize a shared OkHttpClient instance with [newBuilder]. This builds a client that
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Apr 06 04:21:33 GMT 2024
    - 52K bytes
    - Viewed (0)
  4. docs/recipes.md

    === ":material-language-java: Java"
        ```java
          private final OkHttpClient client;
    
          public CacheResponse(File cacheDirectory) throws Exception {
            int cacheSize = 10 * 1024 * 1024; // 10 MiB
            Cache cache = new Cache(cacheDirectory, cacheSize);
    
            client = new OkHttpClient.Builder()
                .cache(cache)
                .build();
          }
    
          public void run() throws Exception {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Fri Feb 18 08:52:22 GMT 2022
    - 40.2K bytes
    - Viewed (1)
Back to top