Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 24 for evictAll (0.21 sec)

  1. docs/features/caching.md

    which is designed to persist between app restarts.
    
    ```kotlin
    cache.delete()
    ```
     
    ## Pruning the Cache
    
    Pruning the entire Cache to clear space temporarily can be done using evictAll.
    
    ```kotlin
    cache.evictAll()
    ```
    
    Removing individual items can be done using the urls iterator.
    This would be typical after a user initiates a force refresh by a pull to refresh type action.
    
    ```java
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sun Feb 06 02:19:09 GMT 2022
    - 3.1K bytes
    - Viewed (0)
  2. okhttp/src/main/kotlin/okhttp3/ConnectionPool.kt

      internal val connectionListener: ConnectionListener
        get() = delegate.connectionListener
    
      /** Close and remove all idle connections in the pool. */
      fun evictAll() {
        delegate.evictAll()
      }
    
      /**
       * Sets a policy that applies to [address].
       * Overwrites any existing policy for that address.
       */
      @ExperimentalOkHttpApi
      fun setPolicy(
        address: Address,
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Wed Apr 03 20:39:41 GMT 2024
    - 5.6K bytes
    - Viewed (0)
  3. okhttp/src/test/java/okhttp3/internal/http/ExternalHttp2Example.kt

          var line: String?
          while (response.body.source().readUtf8Line().also { line = it } != null) {
            println(line)
          }
        } finally {
          response.body.close()
        }
        client.connectionPool.evictAll()
      }
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.4K bytes
    - Viewed (0)
  4. okhttp/src/test/java/okhttp3/internal/cache/DiskLruCacheTest.kt

        assertThat(cache.size()).isEqualTo(0)
      }
    
      @ParameterizedTest
      @ArgumentsSource(FileSystemParamProvider::class)
      fun evictAll(parameters: Pair<FileSystem, Boolean>) {
        setUp(parameters.first, parameters.second)
        set("a", "a", "a")
        set("b", "b", "b")
        cache.evictAll()
        assertThat(cache.size()).isEqualTo(0)
        assertAbsent("a")
        assertAbsent("b")
      }
    
      @ParameterizedTest
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Apr 15 14:55:09 GMT 2024
    - 75.8K bytes
    - Viewed (0)
  5. samples/tlssurvey/src/main/kotlin/okhttp3/survey/ssllabs/SslLabsScrape.kt

        }
      }
    }
    
    suspend fun main() {
      val client = OkHttpClient()
    
      val scraper = SslLabsScraper(client)
    
      println(scraper.query())
    
      client.connectionPool.evictAll()
      client.dispatcher.executorService.shutdown()
    Plain Text
    - Registered: Fri Mar 29 11:42:11 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.7K bytes
    - Viewed (0)
  6. okhttp-testing-support/src/main/kotlin/okhttp3/OkHttpClientTestRule.kt

          uncaughtException = throwable
        }
      }
    
      fun ensureAllConnectionsReleased() {
        testClient?.let {
          val connectionPool = it.connectionPool
    
          connectionPool.evictAll()
          if (connectionPool.connectionCount() > 0) {
            // Minimise test flakiness due to possible race conditions with connections closing.
            // Some number of tests will report here, but not fail due to this delay.
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 10.5K bytes
    - Viewed (0)
  7. okhttp/src/test/java/okhttp3/TestTls13Request.kt

      client: OkHttpClient,
    ) {
      try {
        for (url in urls) {
          sendRequest(client, url)
        }
      } finally {
        client.dispatcher.executorService.shutdownNow()
        client.connectionPool.evictAll()
      }
    }
    
    private fun buildClient(vararg specs: ConnectionSpec): OkHttpClient {
      return OkHttpClient.Builder()
        .connectionSpecs(listOf(*specs))
        .build()
    }
    
    private fun sendRequest(
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3K bytes
    - Viewed (0)
  8. okhttp-dnsoverhttps/src/test/java/okhttp3/dnsoverhttps/TestDohMain.kt

            client = bootstrapClient,
            http2Only = true,
            workingOnly = true,
            getOnly = true,
          )
        runBatch(dnsProviders, names)
      } finally {
        bootstrapClient.connectionPool.evictAll()
        bootstrapClient.dispatcher.executorService.shutdownNow()
        bootstrapClient.cache?.close()
      }
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.2K bytes
    - Viewed (0)
  9. okhttp/src/test/java/okhttp3/JSSETest.kt

        client.newCall(request).execute().use {
          assertThat(it.protocol).isEqualTo(Protocol.HTTP_2)
          assertThat(it.handshake!!.tlsVersion).isEqualTo(TlsVersion.TLS_1_3)
        }
    
        client.connectionPool.evictAll()
        assertEquals(0, client.connectionPool.connectionCount())
    
        client.newCall(request).execute().use {
          assertThat(it.protocol).isEqualTo(Protocol.HTTP_2)
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 5.4K bytes
    - Viewed (0)
  10. samples/guide/src/main/java/okhttp3/recipes/RewriteResponseCacheControl.java

            .build();
      };
    
      private final OkHttpClient client;
    
      public RewriteResponseCacheControl(File cacheDirectory) throws Exception {
        Cache cache = new Cache(cacheDirectory, 1024 * 1024);
        cache.evictAll();
    
        client = new OkHttpClient.Builder()
            .cache(cache)
            .build();
      }
    
      public void run() throws Exception {
        for (int i = 0; i < 5; i++) {
          System.out.println("    Request: " + i);
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Jan 12 03:31:36 GMT 2019
    - 2.6K bytes
    - Viewed (0)
Back to top