public class MapPreparedStatementCache extends Object implements PreparedStatementCache
PreparedStatementCache backed by a Map cache. Defaults to simple ConcurrentHashMap caching.
Statements are cached with a key consisting of Cluster, keyspace and the cql text. Statement
options (idempotency, timeouts) apply from the statement that was initially prepared.| Modifier and Type | Class and Description |
|---|---|
protected static class |
MapPreparedStatementCache.CacheKey
MapPreparedStatementCache.CacheKey for PreparedStatement caching. |
| Modifier and Type | Method and Description |
|---|---|
static MapPreparedStatementCache |
create()
Create a
MapPreparedStatementCache using ConcurrentHashMap. |
protected Map<MapPreparedStatementCache.CacheKey,com.datastax.driver.core.PreparedStatement> |
getCache() |
com.datastax.driver.core.PreparedStatement |
getPreparedStatement(com.datastax.driver.core.Session session,
com.datastax.driver.core.RegularStatement statement,
Supplier<com.datastax.driver.core.PreparedStatement> preparer)
Obtain a
PreparedStatement by Session and RegularStatement. |
static MapPreparedStatementCache |
of(Map<MapPreparedStatementCache.CacheKey,com.datastax.driver.core.PreparedStatement> cache)
Create a
MapPreparedStatementCache using the given Map. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetPreparedStatementpublic static MapPreparedStatementCache create()
MapPreparedStatementCache using ConcurrentHashMap.create in interface PreparedStatementCacheMapPreparedStatementCache backed by ConcurrentHashMap.public static MapPreparedStatementCache of(Map<MapPreparedStatementCache.CacheKey,com.datastax.driver.core.PreparedStatement> cache)
MapPreparedStatementCache using the given Map.MapPreparedStatementCache backed the given Map.protected Map<MapPreparedStatementCache.CacheKey,com.datastax.driver.core.PreparedStatement> getCache()
cache.public com.datastax.driver.core.PreparedStatement getPreparedStatement(com.datastax.driver.core.Session session,
com.datastax.driver.core.RegularStatement statement,
Supplier<com.datastax.driver.core.PreparedStatement> preparer)
PreparedStatementCachePreparedStatement by Session and RegularStatement.getPreparedStatement in interface PreparedStatementCachesession - must not be null.statement - must not be null.preparer - must not be null.PreparedStatement.Copyright © 2011–2018 Pivotal Software, Inc.. All rights reserved.