Remove expired records of all caches
174523
static function gc()
    {
        $rcube = rcube::get_instance();
        $db    = $rcube->get_dbh();

        $db->query("DELETE FROM " . $db->table_name('cache', true) . " WHERE `expires` < " . $db->now());
    }
261849
def clear_stale_cached_connections!
    keys = @reserved_connections.keys - Thread.list.find_all { |t|
      t.alive?
    }.map { |thread| thread.object_id }
    keys.each do |key|
      checkin @reserved_connections[key]
      @reserved_connections.delete(key)
    end
  end
755275
def clean_cache(self):
        
        now = int(time.time())
        t_to_del = []
        for timestamp in self.cache:
            if timestamp < now:
                t_to_del.append(timestamp)
        for timestamp in t_to_del:
            del self.cache[timestamp]

        # same for the invalid cache
        t_to_del = []
        for timestamp in self.invalid_cache:
            if timestamp < now:
                t_to_del.append(timestamp)
        for timestamp in t_to_del:
            del self.invalid_cache[timestamp]
1025259
function() {
            var expirationDays = resume.recordsExpireIn;

            handler._iterateResumeRecords(function(key, uploadData) {
                var expirationDate = new Date(uploadData.lastUpdated);

                // transform updated date into expiration date
                expirationDate.setDate(expirationDate.getDate() + expirationDays);

                if (expirationDate.getTime() <= Date.now()) {
                    log("Removing expired resume record with key " + key);
                    localStorage.removeItem(key);
                }
            });
        }
325325
def _cleanup(self, status, expires_multiplier=1):
        
        """
        # self.expires is inherited, and defaults to 1 day (or setting CELERY_TASK_RESULT_EXPIRES)
        expires = self.expires if isinstance(self.expires, timedelta) else timedelta(seconds=self.expires)
        expires = expires * expires_multiplier
        chords_to_delete = ChordData.objects.filter(
            callback_result__date_done__lte=datetime.now() - expires,
            callback_result__status=status
        ).iterator()
        for _chord in chords_to_delete:
            subtask_ids = [subtask.task_id for subtask in _chord.completed_results.all()]
            _chord.completed_results.clear()
            TaskMeta.objects.filter(task_id__in=subtask_ids).delete()
            _chord.callback_result.delete()
            _chord.delete()
922971
def cleanup(self):
        """"""
        expires = maybe_timedelta(self.expires)
        for model in self.TaskModel, self.TaskSetModel:
            model._default_manager.delete_expired(expires)
1274379
def clean_cache(cached, **kwargs):
    "  "

    if isinstance(cached, basestring):
        cached = _str_to_model(cached)

    cache_key = generate_cache_key(cached, **kwargs)
    cache.delete(cache_key)
60870
def prune_database():
    
    now = datetime.now()
    expired = TokenBlacklist.query.filter(TokenBlacklist.expires < now).all()
    for token in expired:
        db.session.delete(token)
    db.session.commit()
1277522
def clean_old_entries():
    """"""
    from indico_livesync.plugin import LiveSyncPlugin
    from indico_livesync.models.queue import LiveSyncQueueEntry

    queue_entry_ttl = LiveSyncPlugin.settings.get('queue_entry_ttl')
    if not queue_entry_ttl:
        return
    expire_threshold = now_utc() - timedelta(days=queue_entry_ttl)
    LiveSyncQueueEntry.find(LiveSyncQueueEntry.processed,
                            LiveSyncQueueEntry.timestamp < expire_threshold).delete(synchronize_session='fetch')
1293482
def cleanup(used_cache_entries)
      used = Set.new(used_cache_entries)

      Dir[@cache_dir + "/*.dat"].each do |file|
        FileUtils.rm_rf(file) unless used.include?(file)
      end
    end
913365
def clear_cache(self):
        '''
        
        '''
        errors = []
        for rdir in (self.cache_root, self.file_list_cachedir):
            if os.path.exists(rdir):
                try:
                    shutil.rmtree(rdir)
                except OSError as exc:
                    errors.append(
                        'Unable to delete {0}: {1}'.format(rdir, exc)
                    )
        return errors
617153
public void clear() {
    ArrayList<Entry<K, V>> oldExclusives;
    ArrayList<Entry<K, V>> oldEntries;
    synchronized (this) {
      oldExclusives = mExclusiveEntries.clear();
      oldEntries = mCachedEntries.clear();
      makeOrphans(oldEntries);
    }
    maybeClose(oldEntries);
    maybeNotifyExclusiveEntryRemoval(oldExclusives);
    maybeUpdateCacheParams();
  }
654762
function clear() {
        var cache = caches[this.name];
        if (cache && cache.flush && !redisOffline) {
            cache.flush();
        }
    }
1338383
public function deleteExpired()
    {
        $cache = $this->loadCache();
        if (is_array($cache)) {
            $i = 0;
            $cache = array_map(function ($value) use (& $i) {
                if (!$this->isExpired($value['time'], $value['expire'])) {
                    ++$i;
                    return $value;
                }
            }, $cache);
            if ($i > 0) {
                $this->saveCache($cache);
            }
        }
        return $this;
    }
913881
def _cache_is_expired():
        """"""
        now = timezone.now()
        timediff = TransCache.SINGLETON_CREATION_DATETIME - now
        return (timediff.total_seconds() > TransCache.SINGLETON_EXPIRATION_MAX_SECONDS)
596542
public void clearAllCaches() {
        logger.warn("beginning request to clear all caches");
        for (final String cacheName : this.cacheManager.getCacheNames()) {
            clearCache(cacheName);
        }
        logger.warn("completed request to clear all caches");
    }
807173
def clear_all(self):
        
        self._lock.acquire()
        try:
            self._cache = {}
            self._updated = False
        finally:
            self._lock.release()