Remove setting rdataset->ttl to 0. When it is set to 0, stale records in "rndc dumpdb" output show 0 TTLs.
Add rbtdb->serve_stale_ttl to various checks so that stale records are not purged from the cache when they've been stale for RBTDB_VIRTUAL (300) seconds.
Increment ns_statscounter_usedstale when a stale answer is used.
There's a question of whether overmem_purge should be purging ancient records, instead of stale ones. I've left it as purging stale records, since stale records could take up the majority of the cache.
This submission is copyrighted Akamai Technologies, Inc. and provided under an MPL 2.0 license.