本文整理匯總了Java中javax.cache.expiry.Duration.ZERO屬性的典型用法代碼示例。如果您正苦於以下問題:Java Duration.ZERO屬性的具體用法?Java Duration.ZERO怎麽用?Java Duration.ZERO使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類javax.cache.expiry.Duration
的用法示例。
在下文中一共展示了Duration.ZERO屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getDurationCode
private int getDurationCode(Operation op) {
ExpiryPolicy policy = configuration.getExpiryPolicyFactory().create();
Duration expiryDuration = Duration.ZERO;
switch (op) {
case CREATION:
expiryDuration = policy.getExpiryForCreation();
break;
case UPDATE:
expiryDuration = policy.getExpiryForUpdate();
break;
case ACCESS:
expiryDuration = policy.getExpiryForAccess();
break;
}
if (expiryDuration == null) {
return TTL_DONT_CHANGE;
} else if (expiryDuration.isZero()) {
return TTL_EXPIRED;
} else if (expiryDuration.isEternal()) {
return TTL_NONE;
} else {
long longExpiry = expiryDuration.getTimeUnit().toSeconds(expiryDuration.getDurationAmount());
if (longExpiry <= MAX_TTL) {
return (int) longExpiry;
} else {
throw new IllegalArgumentException("Explicit " + op.name()
+ " expiry must be less than 30 days (30 * 24 * 60 * 60 = " + MAX_TTL + "sec)");
}
}
}
示例2: getExpiryForAccess
@Override
public Duration getExpiryForAccess() {
return Duration.ZERO;
}
示例3: getExpiryForCreation
@Override
public Duration getExpiryForCreation() {
return Duration.ZERO;
}
示例4: getExpiryForAccess
@Override
public Duration getExpiryForAccess() {
return Duration.ZERO;
}
示例5: getExpiryForUpdate
@Override
public Duration getExpiryForUpdate() {
return Duration.ZERO;
}