init: init proj

This commit is contained in:
2026-02-26 22:15:35 +08:00
commit 7ef5348f65
43 changed files with 3085 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import Foundation
@Observable
final class ContentCache {
static let shared = ContentCache()
private var timestamps: [String: Date] = [:]
private let ttl: TimeInterval = 300 // 5
private init() {}
func isExpired(key: String) -> Bool {
guard let ts = timestamps[key] else { return true }
return Date().timeIntervalSince(ts) > ttl
}
func markFresh(key: String) {
timestamps[key] = Date()
}
func invalidate(key: String) {
timestamps[key] = nil
}
}