API Reference
Class
DnsResponseCache
Simple in-memory cache for DnsResponse instances. Stores responses together with their expiration times.
Inheritance
- Object
- DnsResponseCache
Constructors
DnsResponseCache(System.Nullable{System.TimeSpan} cleanupInterval, System.Int32 cleanupThreshold) #Initializes a new instance of the DnsResponseCache class.
Parameters
- cleanupInterval System.Nullable{System.TimeSpan}
- Interval for automatic cleanup.
- cleanupThreshold System.Int32
- Maximum number of entries before a cleanup is triggered.
Methods
Cleanup() #Removes expired entries from the cache.
Dispose() #Set(System.String key, DnsClientX.DnsResponse response, System.TimeSpan ttl) #Stores a response in the cache using the specified TTL value.
Parameters
- key System.String
- Cache key.
- response DnsClientX.DnsResponse
- Response to cache.
- ttl System.TimeSpan
- Time to keep the entry.
Returns
None.
TryGet(System.String key, DnsClientX.DnsResponse@ response) #Attempts to retrieve a cached response for a given key.
Parameters
- key System.String
- Cache key.
- response DnsClientX.DnsResponse@
- Retrieved response if found and not expired.
Returns
true if a valid entry was found; otherwise false.