<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def invalidate(self, cls, id_field, id_val):
 """ Invalidate the cache for a given Mongo object by deleting the cached data and the cache flag. """

        cache_key, flag_key = self.get_keys(cls, id_field, id_val)

        pipeline = self.redis.pipeline()
        pipeline.delete(cache_key)
        pipeline.delete(flag_key)
        pipeline.execute()