From 1e59101ada6a7a9939197a9d17b2b215b25a8677 Mon Sep 17 00:00:00 2001 From: games647 Date: Tue, 3 Mar 2020 10:46:43 +0100 Subject: [PATCH] Enable MySQL storage caching --- .../com/github/games647/fastlogin/core/AuthStorage.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java b/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java index 6c90eeed..f01e5655 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java @@ -42,7 +42,6 @@ public class AuthStorage { properties.setProperty("date_string_format", "yyyy-MM-dd HH:mm:ss"); properties.setProperty("useSSL", String.valueOf(useSSL)); config.setDataSourceProperties(properties); - ThreadFactory platformThreadFactory = core.getPlugin().getThreadFactory(); if (platformThreadFactory != null) { config.setThreadFactory(platformThreadFactory); @@ -58,6 +57,13 @@ public class AuthStorage { config.setMaximumPoolSize(1); } else { jdbcUrl += "mysql://" + host + ':' + port + '/' + databasePath; + // enable MySQL specific optimizations + // default prepStmtCacheSize 25 - amount of cached statements - enough for us + // default prepStmtCacheSqlLimit 256 - length of SQL - our queries are not longer + // disabled by default - will return the same prepared statement instance + config.addDataSourceProperty("cachePrepStmts", true); + // default false - available in newer versions caches the statements server-side + config.addDataSourceProperty("useServerPrepStmts", true); } config.setJdbcUrl(jdbcUrl);