nea / vertx-mod-cassandra-persistor

A Vert.x Module to query a Cassandra cluster
Apache License 2.0
9 stars 8 forks source link

Caching for prepared statements and prepare action #3

Closed andyjduncan closed 10 years ago

andyjduncan commented 10 years ago

Hi. Thanks for the module, it's just what I was looking for.

I noticed when I was using it that I was getting a lot of warnings about re-preparing statements. To stop that, I've added a cache for prepared statements. The cache is just a simple map of statements to PreparedStatements. If a new statement is used with the prepared action, it gets prepared and added to the cache.

I've also added a new action to pre-prepare statements before use, so they can be prepared after the module is started. It uses the prepare action and returns the same message as in "general response".

nea commented 10 years ago

Hey Andy

Thanks big time for that. You are of course right, that is something pretty needed. I will merge it this week (when I get some free time ^^'). I will do the merge and then some smaller adjustments to better fit with what I am currently doing in 0.4.0.

Thanks a lot