before caching