Created
August 15, 2025 12:13
-
-
Save jacobsapps/28b70decf79efb4ccc27b6bc56febf35 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var purgeCacheTask: Task<Void, Never>? | |
func setupCacheTTL() { | |
purgeCacheTask?.cancel() | |
purgeCacheTask = Task(priority: .low) { | |
try? await Task.sleep(for: .seconds(300)) | |
guard !Task.isCancelled else { return } | |
cache.clear() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment