validateTtl method
Validates a TTL duration. Throws CacheException if the TTL is invalid.
Implementation
@override
void validateTtl(Duration ttl) {
if (ttl.isNegative) {
throw CacheException('TTL duration cannot be negative');
}
// Check for unreasonably long TTL
const maxTtl = Duration(days: 365 * 10); // 10 years
if (ttl > maxTtl) {
throw CacheException('TTL duration is too long (maximum 10 years)');
}
}