Enable MySQL storage caching

This commit is contained in:
games647
2020-03-03 10:46:43 +01:00
parent 46ac3c74e4
commit 1e59101ada

View File

@ -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);