cache: fixed crash with RR sets with over 255 records
The previous cache version encoded RR count as uint8_t, which doesn't work with RR sets with over 255 records. This caused cache writes to fail and subsequently ending in an assertion failure. It is not very common to have large RR sets, but it has legitimate use cases such as a lot of SRV or address records for large container deployments etc.