Remove wonky cache lookup in execute

This commit is contained in:
Dan Tracy 2015-07-13 13:59:23 -04:00
parent 598c0628d7
commit a724bc53ce
2 changed files with 2 additions and 3 deletions

View file

@ -112,9 +112,8 @@ class CassandraConnection(object):
keyword arguments. See cassandra-python documentation for keyword arguments. See cassandra-python documentation for
definition of those parameters. definition of those parameters.
""" """
stmt = CassandraConnection._prepared_statement_cache.get(query, query)
tornado_future = Future() tornado_future = Future()
cassandra_future = self._session.execute_async(stmt, *args, **kwargs) cassandra_future = self._session.execute_async(query, *args, **kwargs)
self._ioloop.add_callback( self._ioloop.add_callback(
self._callback, cassandra_future, tornado_future) self._callback, cassandra_future, tornado_future)
return tornado_future return tornado_future

View file

@ -74,5 +74,5 @@ class TestCassandraConnectionClass(AsyncTestCase):
stmt = self.connection.prepare('SELECT * FROM names;', 'get_names') stmt = self.connection.prepare('SELECT * FROM names;', 'get_names')
copy = self.connection.prepare('SELECT * FROM names;', 'get_names') copy = self.connection.prepare('SELECT * FROM names;', 'get_names')
self.assertIs(stmt, copy, 'Should return the cached statement') self.assertIs(stmt, copy, 'Should return the cached statement')
results = yield self.connection.execute('get_names') results = yield self.connection.execute(stmt)
self.assertEqual(results[0].name, 'Peabody') self.assertEqual(results[0].name, 'Peabody')