Module spring.data.cassandra
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
ConstructorsModifierConstructorDescriptionprotectedCachedPreparedStatementCreator(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.PreparedStatementcreatePreparedStatement(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 newCachedPreparedStatementCreatorgivenPreparedStatementCacheandSimpleStatementto 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 newCachedPreparedStatementCreatorgivenPreparedStatementCacheandSimpleStatementto prepare. Subsequent calls require the givenSimpleStatementobject 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
CachedPreparedStatementCreatorforStatement.
-
of
Deprecated.Create a newCachedPreparedStatementCreatorgivenPreparedStatementCacheandcqlto prepare. Subsequent calls require the given CQL statement thatare equalto 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
CachedPreparedStatementCreatorforcql.
-
of
public static CachedPreparedStatementCreator of(PreparedStatementCache cache, String cql, QueryOptions queryOptions) Deprecated.Create a newCachedPreparedStatementCreatorgivenPreparedStatementCacheandcqlto prepare. This method appliesQueryOptionsto theSimpleStatementbefore preparing it. Subsequent calls require the given CQL statement thatare equalto 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
CachedPreparedStatementCreatorforcql.
-
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:PreparedStatementCreatorCreate a statement in this session. Allows implementations to usePreparedStatement.- Specified by:
createPreparedStatementin interfacePreparedStatementCreator- Parameters:
session-CqlSessionto use to create statement.- Returns:
- a prepared statement.
- Throws:
com.datastax.oss.driver.api.core.DriverException- there is no need to catchDriverExceptionthat may be thrown in the implementation of this method. TheCqlTemplateclass will handle them.
-