

def _purge_cache_locked(self):
    now = time.time()
    if ((self.lastpurge is not None) and ((now - self.lastpurge) < (60 * 60))):
        return
    self.lastpurge = now
    then = (now - file.cachelifetime)
    LOG.debug(('Looking for files in %s older than %d' % (self.cachedir, then)))
    for file in os.listdir(self.cachedir):
        if (file == 'lock'):
            continue
        filepath = os.path.join(self.cachedir, file)
        mtime = os.path.getmtime(filepath)
        LOG.debug(('File %s has time %d' % (filepath, mtime)))
        if (mtime < then):
            LOG.info(('Purging outdated cache %s' % filepath))
            os.unlink(filepath)

dataset/ETHPy150Open berrange/gerrymander/gerrymander/client.py ClientCaching._purge_cache_locked/VarMisuse@62/74 `self`->`file`