Hi, We are building REST APIs for Cassandra using the Cassandra Java Driver.
So as per the below guidlines from the documentation, we are caching the Cluster instance (per cluster) and the Session instance (per keyspace) as they are multi thread safe. http://www.datastax.com/documentation/developer/java-driver/2.0/java-driver/fourSimpleRules.html As the Cluster and Session instance(s) are cached in the application already and also as the PreparedStatement provide better performance, we thought to build the PreparedStatement for REST query implicitly (as REST calls are stateless) and cache the PreparedStatemen. Whenever a REST query is invoked, we look for a PreparedStatement in the cache and create and put it in the cache if it doesn't exists. (The cache is a in-memory fixed size LRU based). Is a safe approach to cache PreparedStatement in the client side?. Looking at the Java driver code, the Cluster class stores the PreparedStatements as a weak reference (to rebuild when a node is down or a new node added). Thanks Ajay