NAME
DNSQuery::Cache - DNS query cache with TTL support and disk persistence
SYNOPSIS
use DNSQuery::Cache;
my $cache = DNSQuery::Cache->new(
max_size => 100,
persist => 1,
cache_file => '/tmp/dnsq_cache.dat',
);
$cache->set($key, $value, $ttl);
my $value = $cache->get($key);
$cache->clear();
DESCRIPTION
Provides an LRU cache with TTL support and optional disk persistence.
get($key)
Retrieve a value from cache. Returns undef if not found or expired.
set($key, $value, $ttl)
Store a value in cache with the specified TTL (in seconds). If TTL is not provided, uses a default of 60 seconds.
delete($key)
Remove a specific entry from cache.
clear()
Clear all entries from cache.
size()
Return the current number of entries in cache.
get_stats()
Return cache statistics.
cleanup_expired()
Remove all expired entries from cache.
AUTHOR
DNSQuery Project
LICENSE
MIT License