/** * Constructor used by ehcache-server * * @param key any non null value * @param value any value, including nulls * @param eternal specify as non-null to override cache configuration * @param timeToIdleSeconds specify as non-null to override cache configuration * @param timeToLiveSeconds specify as non-null to override cache configuration */ public Element( Object key, Object value, Boolean eternal, Integer timeToIdleSeconds, Integer timeToLiveSeconds) { this.key = key; this.value = value; if (eternal != null) { setEternal(eternal.booleanValue()); } if (timeToIdleSeconds != null) { setTimeToIdle(timeToIdleSeconds.intValue()); } if (timeToLiveSeconds != null) { setTimeToLive(timeToLiveSeconds.intValue()); } creationTime = System.currentTimeMillis(); }
/** * Constructor used by ehcache-server * * <p>timeToIdleSeconds and timeToLiveSeconds will have precedence over eternal. Which means that * what ever eternal says, non-null timeToIdleSeconds or timeToLiveSeconds will result in the * element not being eternal * * @param key any non null value * @param value any value, including nulls * @param eternal specify as non-null to override cache configuration * @param timeToIdleSeconds specify as non-null to override cache configuration * @param timeToLiveSeconds specify as non-null to override cache configuration * @deprecated */ @Deprecated public Element( final Object key, final Object value, final Boolean eternal, final Integer timeToIdleSeconds, final Integer timeToLiveSeconds) { this.key = key; this.value = value; if (eternal != null) { setEternal(eternal.booleanValue()); } if (timeToIdleSeconds != null) { setTimeToIdle(timeToIdleSeconds.intValue()); } if (timeToLiveSeconds != null) { setTimeToLive(timeToLiveSeconds.intValue()); } this.creationTime = getCurrentTime(); }
/** * Constructor * * @param key any non null value * @param value any value, including nulls * @param eternal whether this element is eternal * @since 2.7.1 */ public Element(final Object key, final Object value, final boolean eternal) { this(key, value); setEternal(eternal); }