Reimplement cache invalidation code