use vtcode_config::core::AnthropicPromptCacheSettings;
pub fn get_cache_ttl_for_seconds(ttl_seconds: u64) -> &'static str {
if ttl_seconds >= 3600 { "1h" } else { "5m" }
}
pub fn get_tools_cache_ttl(settings: &AnthropicPromptCacheSettings) -> &'static str {
if settings.prefer_extended_ttl {
return "1h";
}
get_cache_ttl_for_seconds(settings.tools_ttl_seconds)
}
pub fn get_messages_cache_ttl(settings: &AnthropicPromptCacheSettings) -> &'static str {
if settings.prefer_extended_ttl {
return "1h";
}
get_cache_ttl_for_seconds(settings.messages_ttl_seconds)
}
pub fn get_profile_cache_ttl(settings: &AnthropicPromptCacheSettings) -> &'static str {
match settings.extended_ttl_seconds {
Some(seconds) => get_cache_ttl_for_seconds(seconds),
None => "1h",
}
}
pub fn requires_extended_ttl_beta(settings: &AnthropicPromptCacheSettings) -> bool {
get_tools_cache_ttl(settings) == "1h" || get_messages_cache_ttl(settings) == "1h"
}