[code] simplify caching mechanism