Improve handling of the token cache.