Expire ultracache cache keys affected by this object
777130
def on_post_delete(sender, **kwargs):
    
    if not invalidate:
        return
    if kwargs.get("raw", False):
        return
    if sender is MigrationRecorder.Migration:
        return
    if issubclass(sender, Model):
        obj = kwargs["instance"]
        if isinstance(obj, Model):
            # get_for_model itself is cached
            try:
                ct = ContentType.objects.get_for_model(sender)
            except RuntimeError:
                # This happens when ultracache is being used by another product
                # during a test run.
                return

            # Expire cache keys
            key = "ucache-%s-%s" % (ct.id, obj.pk)
            to_delete = cache.get(key, [])
            if to_delete:
                try:
                    cache.delete_many(to_delete)
                except NotImplementedError:
                    for k in to_delete:
                        cache.delete(k)
            cache.delete(key)

            # Invalidate paths in reverse caching proxy
            key = "ucache-pth-%s-%s" % (ct.id, obj.pk)
            if purger is not None:
                for li in cache.get(key, []):
                    purger(li[0], li[1])
            cache.delete(key)
295999
def _purge_expired(self):
        
        time_horizon = time.time() - self._keep_time
        new_cache = {}
        for (k, v) in self._cache.items():
            if v.timestamp > time_horizon:
                new_cache[k] = v
        self._cache = new_cache
611187
def expire_at(self, _time):
        
        return self._client.expireat(self.key_prefix, round(_time))
682061
function set (key, value, time = 60) {
  let expireTime
  const cacheKey = `${prefix}${key}`
  const expireKey = `${expire}${key}`

  if (typeof time === 'number') {
    expireTime = dateAdd(Date.now(), 'minute', time)
  } else if (time !== null && typeof time === 'object' && time.interval && time.units) {
    expireTime = dateAdd(Date.now(), time.interval, time.units)
  } else {
    throw new Error('Invalid time provided for set')
  }

  return storage.set(expireKey, expireTime).then(() => storage.set(cacheKey, value))
}
183541
protected function expire($key = array(), $ttl = 0)
    {
        if ($ttl === 0) {
            // when storing indefinitely, there's no point in keeping it around,
            // it won't just expire
            return;
        }

        // $key can be both string (1 key) or array (multiple)
        $keys = (array) $key;

        $time = time() + $ttl;
        foreach ($keys as $key) {
            $this->expires[$key] = $time;
        }
    }
299209
public Long expireAt(Object key, long unixTime) {
		Jedis jedis = getJedis();
		try {
			return jedis.expireAt(keyToBytes(key), unixTime);
		}
		finally {close(jedis);}
	}
63935
def cache_clean(self):
		
		now = time.time()
		keys_for_removal = collections.deque()
		for key, (_, expiration) in self.__cache.items():
			if expiration < now:
				keys_for_removal.append(key)
		for key in keys_for_removal:
			del self.__cache[key]
514016
function setExpiry(key, ms, req) {
  var rval = this.getRawKey(key);
  if(rval === undefined) return 0;
  // expiry is in the past or now, delete immediately
  // but return 1 to indicate the expiry was set
  if(ms <= Date.now()) {
    this.delKey(key, req);
    return 1;
  }
  if(!this._expires[key]) {
    this._ekeys.push(key);
  }
  this._expires[key] = ms;
  rval.e = ms;
  return 1;
}
1308028
def expires_at(self):
        """"""
        try:
            expires = min(sig.key_expiration for sig in itertools.chain(iter(uid.selfsig for uid in self.userids), self.self_signatures)
                          if sig.key_expiration is not None)

        except ValueError:
            return None

        else:
            return (self.created + expires)
1363189
function setCache($cache,$expire=3600)
	{
		$this->cache = $cache;
		$this->if_cache = true;
		$this->expire = $expire;
	}
637829
function isExpired (key) {
  const expireKey = `${expire}${key}`
  return storage
    .get(expireKey)
    .then(time => Promise.resolve(Date.now() >= new Date(time).getTime(), time))
}
490090
protected void pruneCache() {
        final long expired = System.currentTimeMillis() - timeToLive;
        this.cacheMap.values().removeIf(entry -> entry.createTime < expired);
    }
773900
function () {
            var cache = this._cache;
            var expirationTime = ((new Date()).getTime() - this._expiresAfter * 1000);

            for (var url in cache) {
                if (cache.hasOwnProperty(url) && cache[url].age < expirationTime) {
                    delete cache[url];
                }
            }
        }
905088
def expire(self, time=None):
        """"""
        if time is None:
            time = self.__timer()
        root = self.__root
        curr = root.next
        links = self.__links
        cache_delitem = Cache.__delitem__
        while curr is not root and curr.expire < time:
            cache_delitem(self, curr.key)
            del links[curr.key]
            next = curr.next
            curr.unlink()
            curr = next
1132084
def expire_at(self, key, _time):
        
        return self._client.expireat(self.get_key(key), round(_time))
1270825
public void valueWasAccessed(DCache cache, Object id, long expirationTime, int inactivity) {
        valueHasChanged(cache, id, expirationTime, inactivity);
    }
31967
function expire() {
  var dbs = this._store.databases, i;
  for(i in dbs) {
    dbs[i].delExpiredKeys();
  }
}