package org.cache2k.expiry;

/*
 * #%L
 * cache2k API
 * %%
 * Copyright (C) 2000 - 2020 headissue GmbH, Munich
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

import org.cache2k.config.Cache2kConfig;
import org.cache2k.io.ResiliencePolicy;
import org.cache2k.processor.MutableCacheEntry;

/**
 * Expiry time values that have a special meaning. Used for expressive return values in the
 * customizations {@link ResiliencePolicy} and {@link ExpiryPolicy}
 * as well as {@link org.cache2k.Cache#expireAt(Object, long)}.
 *
 * <p>Users may want to use the class {@link Expiry} with additional utility methods as
 * alternative.
 *
 * @author Jens Wilke
 * @see ExpiryPolicy
 * @see ResiliencePolicy
 * @see org.cache2k.Cache#expireAt
 * @see Expiry
 */
public interface ExpiryTimeValues {

  /**
   * Don't change the expiry of the entry. This can be used for an update.
   * This is also used for an undefined / not applicable expiry time value
   * in {@link MutableCacheEntry#getExpiryTime()}. The value is {@value #NEUTRAL}, it is
   * identical to {@link Cache2kConfig#UNSET_LONG}
   */
  long NEUTRAL = Cache2kConfig.UNSET_LONG;

  /**
   * The value expires immediately.  An immediate load is triggered if
   * {@link org.cache2k.Cache2kBuilder#refreshAhead} is enabled.
   */
  long NOW = 0;

  /**
   * Starts a refresh. The current value is visible until the refresh is complete.
   * With a negative value get requests will block until the refreshed value is available.
   * <p>Rationale: Any value in the past does and between the current time, does the same
   * as if the time is reached just now.
   */
  long REFRESH = 1234;

  /**
   * Return value signalling to keep the value forever in the cache, switching off expiry.
   * If the cache has a static expiry time configured, then this is used instead.
   */
  long ETERNAL = Long.MAX_VALUE;

}

@@ -1252,16 +1252,84 @@
 xpireAt%0A
+ * @see org.cache2k.processor.MutableCacheEntry#setExpiryTime(long)%0A
  * @see 
@@ -1766,49 +1766,134 @@
 tely
-.  An immediate load is triggered if%0A   *
+ and will not be cached. No refreshing is started.%0A   */%0A  long NOW = 0;%0A%0A  /**%0A   * Expires the entry and starts a refresh if
  %7B@l
@@ -1936,16 +1936,21 @@
 shAhead%7D
+%0A   *
  is enab
@@ -1957,62 +1957,32 @@
 led.
-%0A   */%0A  long NOW = 0;%0A%0A  /**%0A   * Starts a refresh. T
+ With a positive value t
 he c
@@ -2063,19 +2063,31 @@
 e value 
-get
+a %7B@code get()%7D
  request
@@ -2120,24 +2120,29 @@
 reshed value
+%0A   *
  is availabl
@@ -2144,16 +2144,21 @@
 ilable.%0A
+   *%0A
    * %3Cp%3E
@@ -2229,16 +2229,21 @@
 me, does
+%0A   *
  the sam
@@ -2243,21 +2243,16 @@
 the same
-%0A   *
  as if t

update Java Doc