移除缓存对象并通知事件
@param key
@param expire 是否超时才执行的移除
@return
356763
protected TimedEntry<K, V> removeAndListener(Object key,final boolean expire)
	{
		final TimedEntry<K, V> entry=entryMap.remove(key);
		try {
			if(entry!=null)
			{//通知被移除
				final EventListener<K, V> listener=entry.listener;
				entry.setListener(null);
				if(listener!=null)
				{
					lisenterExecutor.execute(new Runnable() {
						@Override
						public void run() {
							try {
								listener.removed(entry.getKey(),entry.getValue(),expire);
							} catch (Throwable e) {
								log.error(e.getMessage(),e);
							}
						}
					});
				}
			}
		} catch (Exception e) {
			log.error(e.getMessage(),e);
		}
		return entry;
	}
284821
public static function expire(string $key)
        {
            if (($cacheValue = self::GetInstance()->get("\$vxnKey:{$key}")) === false) {
                return false;
            }

            return $cacheValue['$_expire'];
        }
1079394
@Override
    public byte[] set(byte[] key, byte[] value, int expireTime) {
        if (key == null) {
            return null;
        }
        Jedis jedis = getJedis();
        try {
            jedis.set(key, value);
            // -1 and 0 is not a valid expire time in Jedis
            if (expireTime > 0) {
                jedis.expire(key, expireTime);
            }
         } finally {
            jedis.close();
        }
        return value;
    }
687125
public function expires($key)
    {
        if (!isset($this->records[$key])) {
            return 0;
        }

        return (int) max(0, $this->records[$key]['expire'] - time());
    }
941800
public function doSet(string $key, $data, int $expire = self::EXPIRE): bool
    {
        //我们不关注返回值
        Redis::string(self::PREFIX . $key, json($data),  $expire);
        return true;
    }
588014
public V get(K key) {
		// 尝试读取缓存
		readLock.lock();
		V value;
		try {
			value = cache.get(key);
		} finally {
			readLock.unlock();
		}
		return value;
	}
675594
@Override
    public CompletableFuture<Void> refreshAsync(String key, int expireSeconds) {
        return setExpireSecondsAsync(key, expireSeconds);
    }
1136856
public Long pexpireAt(Object key, long millisecondsTimestamp) {
		Jedis jedis = getJedis();
		try {
			return jedis.pexpireAt(keyToBytes(key), millisecondsTimestamp);
		}
		finally {close(jedis);}
	}
869879
public static Date getEventDate(Key key)
    {
        Key ek = findAncestor(Repository.EVENT, key);
        return new Date(ek.getId());
    }
494984
public OneStepDistributedRowLock<K, C> expireLockAfter(long timeout, TimeUnit unit) {
        this.timeout      = timeout;
        this.timeoutUnits = unit;
        return this;
    }
663257
public static boolean lock(CacheConfigBean cacheConfigBean, String key, Object valueObj, int expireTimeInSecond, long timeOutInSecond) {
        final LockData lockData = LOCK_THREAD_DATA.get();
        if (lockData != null) {
            lockData.getLockCount().incrementAndGet();
            return true;
        }

        long startNano = System.nanoTime();

        // 重试间隔等待时间
        final int retryAwait = (int) timeOutInSecond * 1000 / TRY_NUM;

        int autoIncrementTryNum = 0;
        do {
            autoIncrementTryNum++;

            String result = "nil";
            try (Jedis jedis = Redis.useDataSource(cacheConfigBean).getResource()) {
                if (jedis != null)
                    result = ObjectCacheOperate.set(jedis, key, valueObj, "EX", expireTimeInSecond, "NX");
            } catch (Exception e) {
                LOG.error(e);
            }

            if (!EnvUtil.getEnv().equals(EnvUtil.PRODUCTION))
                LOG.info(String.format("SET %s \"%s\" EX %s NX = result: %s, 第 %s 次尝试", key, valueObj, expireTimeInSecond, result, autoIncrementTryNum));

            if ("OK".equals(result)) {
                LOCK_THREAD_DATA.set(new LockData(key, FormatUtil.formatValue(valueObj)));

                if (!EnvUtil.getEnv().equals(EnvUtil.PRODUCTION)) {
                    long endNano = System.nanoTime();
                    long consumeTime = (endNano - startNano) / 1000000;
                    LOG.info(String.format("key: %s, 分布式加锁, 尝试次数： %s, 累计耗时: %s 纳秒", key, autoIncrementTryNum, consumeTime));
                }

                return true;
            }

            if (!EnvUtil.getEnv().equals(EnvUtil.PRODUCTION))
                LOG.info(String.format("key: %s, 分布式加锁, 目前尝试次数: %s, 暂停: %s 毫秒后继续尝试", key, autoIncrementTryNum, retryAwait));

            LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(retryAwait));

        } while (autoIncrementTryNum < TRY_NUM);

        return false;
    }
385842
public function touch($key, $expiration = null) {

		if(false === is_string($key) && false === is_array($key)) {
   			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or array, "%s" given', __METHOD__, gettype($key)), E_USER_ERROR);
   		}

   		if(0 === strlen($key)) {
   			return trigger_error(sprintf('Argument 1 passed to %s() may not be an empty string', __METHOD__), E_USER_ERROR);
   		}

		if(true === $this -> exists($key)) {

			$info = apcu_cache_info();

			if(true === is_array($info) && true === isset($info['cache_list'])) {

				foreach($info['cache_list'] as $index) {

					if(true === isset($index['info'], $index['ttl']) && $index['info'] === $key) {

						$data 		= $this -> get($key);
						$expiration = $index['ttl'];

						$this -> expire($key);
						$this -> set($key, $data, $expiration);
						break;
					}
				}
			}
		}

		return $this;
	}
496586
public Iterable<DConnection> queryByExpireTime(java.util.Date expireTime) {
    return queryByField(null, DConnectionMapper.Field.EXPIRETIME.getFieldName(), expireTime);
  }
1111060
function expire( $key ) {
            $this->_logger->entrance( 'key = ' . $key );

            $cache_entry = $this->_options->get_option( $key, false );

            if ( is_object( $cache_entry ) &&
                 isset( $cache_entry->timestamp ) &&
                 is_numeric( $cache_entry->timestamp )
            ) {
                // Set to expired.
                $cache_entry->timestamp = WP_FS__SCRIPT_START_TIME;
                $this->_options->set_option( $key, $cache_entry, true );
            }
        }
884127
protected function doSet(string $key, $data, int $expire = self::EXPIRE): bool
    {
        /**
         * @var $handle \Memcache|\Memcached
         */
        $handle = $this->_handle;

        // 缓存数据
        return $handle->set($key, $data, MEMCACHE_COMPRESSED, $expire);
    }
1091347
public function expire(Memento\Key $key = null)
    {
        $this->__connect($key);
        $expiresKey = $this->groupKey ? $this->groupKey : $key;
        $this->redis->hset($expiresKey->getKey(), Memento\Hash::FIELD_EXPIRES, 0);

        return (0 === intval($this->redis->hget($expiresKey->getKey(), Memento\Hash::FIELD_EXPIRES)));
    }
512359
@Override
    public CompletableFuture<Collection<V>> getCollectionAndRefreshAsync(String key, int expireSeconds) {
        return (CompletableFuture) refreshAsync(key, expireSeconds).thenCompose(v -> getCollectionAsync(key));
    }