Package dev.cachly

Class EdgeCacheClient

java.lang.Object
dev.cachly.EdgeCacheClient

public class EdgeCacheClient extends Object
Client for managing Cloudflare Edge Cache for a cachly instance.

Provides methods to get/set configuration, purge cache, and retrieve statistics. Obtain via CachlyClient.edge().

Example usage


 EdgeCacheClient edge = client.edge();

 // Enable edge caching with 120s TTL
 EdgeCacheConfig cfg = edge.setConfig(
     EdgeCacheConfigUpdate.builder()
         .enabled(true)
         .edgeTtl(120)
         .build()
 );

 // Purge specific namespaces
 EdgePurgeResult result = edge.purge(
     EdgePurgeOptions.forNamespaces(List.of("cachly:sem:qa"))
 );

 // Check stats
 EdgeCacheStats stats = edge.stats();
 System.out.printf("Hit rate: %.1f%%\n", stats.getHitRate() * 100);
 
  • Constructor Details

    • EdgeCacheClient

      public EdgeCacheClient(String edgeApiUrl)
      Create a new EdgeCacheClient.
      Parameters:
      edgeApiUrl - Edge Cache Management API URL (e.g., https://api.cachly.dev/v1/edge/{token})
  • Method Details