The minimum cacheTtl parameter for Workers KV has been reduced from 60 seconds to 30 seconds. This change applies to both get() and getWithMetadata() methods.
This reduction allows you to maintain more up-to-date cached data and have finer-grained control over cache behavior. Applications requiring faster data refresh rates can now configure cache durations as low as 30 seconds instead of the previous 60-second minimum.
The cacheTtl parameter defines how long a KV result is cached at the global network location it is accessed from:
// Read with custom cache TTLconst value = await env.NAMESPACE.get("my-key", { cacheTtl: 30, // Cache for minimum 30 seconds (previously 60)});
// getWithMetadata also supports the reduced cache TTLconst valueWithMetadata = await env.NAMESPACE.getWithMetadata("my-key", { cacheTtl: 30, // Cache for minimum 30 seconds});The default cache TTL remains unchanged at 60 seconds. Upgrade to the latest version of Wrangler to be able to use 30 seconds cacheTtl.
This change affects all KV read operations using the binding API. For more information, consult the Workers KV cache TTL documentation.
Source: Cloudflare




