Interface for different cache types

This commit is contained in:
Andrew Golovashevich 2025-03-26 19:55:41 +03:00
parent a3909e2a5c
commit 491333e1ee
2 changed files with 14 additions and 1 deletions

View File

@ -0,0 +1,12 @@
package ru.langrafhomyak.db.jdbc_resources_manager;
import org.jetbrains.annotations.NotNull;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public interface PreparedStatementsCompilationCache {
@NotNull
PreparedStatement preparedStatementForConnection(@NotNull Connection connection) throws SQLException;
}

View File

@ -11,7 +11,7 @@ import java.sql.SQLException;
import static java.lang.System.identityHashCode;
public class PreparedStatementsCompilationPhantomCache /*implements ReadOnlyProperty<Object,?>*/ {
public class PreparedStatementsCompilationPhantomCache implements PreparedStatementsCompilationCache {
@NotNull
private final String _statementSource;
@NotNull
@ -22,6 +22,7 @@ public class PreparedStatementsCompilationPhantomCache /*implements ReadOnlyProp
this._map = new _SynchronizedEmbedKeyHashMap<>();
}
@Override
@NotNull
public PreparedStatement preparedStatementForConnection(@NotNull Connection connection) throws SQLException {
final int key = identityHashCode(connection);