Cache database enrollment lookups

This avoids doing a query for every alternative we test against.