Class CachedPreparedStatementCreator
java.lang.Object
org.springframework.data.cassandra.core.cql.support.CachedPreparedStatementCreator
- All Implemented Interfaces:
PreparedStatementCreator
@Deprecated
public class CachedPreparedStatementCreator
extends Object
implements PreparedStatementCreator
Deprecated.
since 3.2, the Cassandra driver has a built-in prepared statement cache with makes external caching of
prepared statements superfluous.
PreparedStatementCreator
implementation using caching of prepared statements.
Regular CQL statements are prepared on first use and executed as prepared statements. Prepared statements are cached
by Cassandra itself (invalidation/eviction possible), in the driver to be able to re-prepare a statement and in this
CachedPreparedStatementCreator
using PreparedStatementCache
.
- Since:
- 2.0
- Author:
- Mark Paluch
- See Also:
-
Constructor Summary
ModifierConstructorDescriptionprotected
CachedPreparedStatementCreator
(PreparedStatementCache cache, com.datastax.oss.driver.api.core.cql.SimpleStatement statement) Deprecated.Create a newCachedPreparedStatementCreator
. -
Method Summary
Modifier and TypeMethodDescriptioncom.datastax.oss.driver.api.core.cql.PreparedStatement
createPreparedStatement
(com.datastax.oss.driver.api.core.CqlSession session) Deprecated.Create a statement in this session.getCache()
Deprecated.of
(PreparedStatementCache cache, com.datastax.oss.driver.api.core.cql.SimpleStatement statement) Deprecated.Create a newCachedPreparedStatementCreator
givenPreparedStatementCache
andSimpleStatement
to prepare.of
(PreparedStatementCache cache, String cql) Deprecated.of
(PreparedStatementCache cache, String cql, QueryOptions queryOptions) Deprecated.
-
Constructor Details
-
CachedPreparedStatementCreator
protected CachedPreparedStatementCreator(PreparedStatementCache cache, com.datastax.oss.driver.api.core.cql.SimpleStatement statement) Deprecated.Create a newCachedPreparedStatementCreator
.- Parameters:
cache
- must not be null.statement
- must not be null.
-
-
Method Details
-
of
public static CachedPreparedStatementCreator of(PreparedStatementCache cache, com.datastax.oss.driver.api.core.cql.SimpleStatement statement) Deprecated.Create a newCachedPreparedStatementCreator
givenPreparedStatementCache
andSimpleStatement
to prepare. Subsequent calls require the givenSimpleStatement
object with the same CQL test for a cache hit. Otherwise, the statement is likely to be re-prepared.- Parameters:
cache
- must not be null.statement
- must not be null.- Returns:
- the
CachedPreparedStatementCreator
forStatement
.
-
of
Deprecated.Create a newCachedPreparedStatementCreator
givenPreparedStatementCache
andcql
to prepare. Subsequent calls require the given CQL statement thatare equal
to the previously used CQL string for a cache hit. Otherwise, the statement is likely to be re-prepared.- Parameters:
cache
- must not be null.cql
- must not be null or empty.- Returns:
- the
CachedPreparedStatementCreator
forcql
.
-
of
public static CachedPreparedStatementCreator of(PreparedStatementCache cache, String cql, QueryOptions queryOptions) Deprecated.Create a newCachedPreparedStatementCreator
givenPreparedStatementCache
andcql
to prepare. This method appliesQueryOptions
to theSimpleStatement
before preparing it. Subsequent calls require the given CQL statement thatare equal
to the previously used CQL string for a cache hit. Otherwise, the statement is likely to be re-prepared.- Parameters:
cache
- must not be null.cql
- must not be null or empty.queryOptions
- must not be null.- Returns:
- the
CachedPreparedStatementCreator
forcql
.
-
getCache
Deprecated.- Returns:
- the underlying
PreparedStatementCache
.
-
createPreparedStatement
public com.datastax.oss.driver.api.core.cql.PreparedStatement createPreparedStatement(com.datastax.oss.driver.api.core.CqlSession session) throws com.datastax.oss.driver.api.core.DriverException Deprecated.Description copied from interface:PreparedStatementCreator
Create a statement in this session. Allows implementations to usePreparedStatement
.- Specified by:
createPreparedStatement
in interfacePreparedStatementCreator
- Parameters:
session
-CqlSession
to use to create statement.- Returns:
- a prepared statement.
- Throws:
com.datastax.oss.driver.api.core.DriverException
- there is no need to catchDriverException
that may be thrown in the implementation of this method. TheCqlTemplate
class will handle them.
-