mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-29 08:36:45 +01:00
Make cache expiration configurable
This commit is contained in:
parent
181c5b134f
commit
e139550949
@ -527,6 +527,13 @@ public class Settings extends Config {
|
|||||||
public static int TARGET_TIME = 65;
|
public static int TARGET_TIME = 65;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Comment("Settings related to tab completion")
|
||||||
|
public static final class Tab_Completions {
|
||||||
|
@Comment({"The time in seconds how long tab completions should remain in cache.",
|
||||||
|
"0 will disable caching. Lower values may be less performant."})
|
||||||
|
public static int CACHE_EXPIRATION = 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Comment({"Enable or disable parts of the plugin",
|
@Comment({"Enable or disable parts of the plugin",
|
||||||
"Note: A cache will use some memory if enabled"})
|
"Note: A cache will use some memory if enabled"})
|
||||||
|
@ -56,7 +56,9 @@ import java.util.stream.Collectors;
|
|||||||
public class TabCompletions {
|
public class TabCompletions {
|
||||||
|
|
||||||
private final Cache<String, List<String>> cachedCompletionValues =
|
private final Cache<String, List<String>> cachedCompletionValues =
|
||||||
CacheBuilder.newBuilder().expireAfterWrite(15, TimeUnit.SECONDS).build();
|
CacheBuilder.newBuilder()
|
||||||
|
.expireAfterWrite(Settings.Tab_Completions.CACHE_EXPIRATION, TimeUnit.SECONDS)
|
||||||
|
.build();
|
||||||
|
|
||||||
private final Command booleanTrueCompletion = new Command(null, false, "true", "",
|
private final Command booleanTrueCompletion = new Command(null, false, "true", "",
|
||||||
RequiredType.NONE, null) {};
|
RequiredType.NONE, null) {};
|
||||||
|
Loading…
Reference in New Issue
Block a user