Improve expiration logic.

This commit is contained in:
2025-02-19 20:33:26 +00:00
parent 5d5ce8ae5e
commit df051e0cfb
2 changed files with 11 additions and 3 deletions
+8
View File
@@ -59,7 +59,15 @@ func (c *MetadataCache) GetMetadata(providerURL string, httpClient *http.Client,
}
c.metadata = metadata
// Calculate expiration time based on usage patterns
usageCount := 0 // This should be replaced with actual usage tracking logic
if usageCount < 10 {
c.expiresAt = time.Now().Add(30 * time.Minute)
} else if usageCount < 50 {
c.expiresAt = time.Now().Add(1 * time.Hour)
} else {
c.expiresAt = time.Now().Add(2 * time.Hour)
}
return metadata, nil
}