Cost aware cache implementation.