mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-31 11:17:33 +02:00
Enable MySQL storage caching
This commit is contained in:
@ -42,7 +42,6 @@ public class AuthStorage {
|
|||||||
properties.setProperty("date_string_format", "yyyy-MM-dd HH:mm:ss");
|
properties.setProperty("date_string_format", "yyyy-MM-dd HH:mm:ss");
|
||||||
properties.setProperty("useSSL", String.valueOf(useSSL));
|
properties.setProperty("useSSL", String.valueOf(useSSL));
|
||||||
config.setDataSourceProperties(properties);
|
config.setDataSourceProperties(properties);
|
||||||
|
|
||||||
ThreadFactory platformThreadFactory = core.getPlugin().getThreadFactory();
|
ThreadFactory platformThreadFactory = core.getPlugin().getThreadFactory();
|
||||||
if (platformThreadFactory != null) {
|
if (platformThreadFactory != null) {
|
||||||
config.setThreadFactory(platformThreadFactory);
|
config.setThreadFactory(platformThreadFactory);
|
||||||
@ -58,6 +57,13 @@ public class AuthStorage {
|
|||||||
config.setMaximumPoolSize(1);
|
config.setMaximumPoolSize(1);
|
||||||
} else {
|
} else {
|
||||||
jdbcUrl += "mysql://" + host + ':' + port + '/' + databasePath;
|
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);
|
config.setJdbcUrl(jdbcUrl);
|
||||||
|
Reference in New Issue
Block a user