Implementation with cache