def auto_invalidate(self):
        """
        Invalidate the cache if the current time is past the time to live.
        """
        current = datetime.now()
        if current > self._invalidated + timedelta(seconds=self._timetolive):
            self.invalidate()
def auto_invalidate ( self ) : current = datetime . now ( ) if current > self . _invalidated + timedelta ( seconds = self . _timetolive ) : self . invalidate ( )
Invalidate the cache if the current time is past the time to live.