This commit is contained in:
redkale
2023-12-29 14:39:12 +08:00
parent 372f96b3a9
commit 718dfc6fd1
4 changed files with 29 additions and 15 deletions

View File

@@ -118,6 +118,20 @@ public class CacheAction {
return null;
} else if ("0".equals(str)) {
return Duration.ZERO;
} else if (str.indexOf('*') > -1) {
long rs = 1;
for (String v : str.split("\\*")) {
if (!v.trim().isEmpty()) {
rs *= Long.parseLong(v.trim());
}
}
if (rs < 0) {
return null;
} else if (rs == 0) {
return Duration.ZERO;
} else {
return Duration.ofMillis(cached.getTimeUnit().toMillis(rs));
}
} else {
return Duration.ofMillis(cached.getTimeUnit().toMillis(Long.parseLong(str)));
}