mirror of
https://github.com/sprockets/sprockets.clients.cassandra.git
synced 2024-11-22 03:00:20 +00:00
Remove wonky cache lookup in execute
This commit is contained in:
parent
598c0628d7
commit
a724bc53ce
2 changed files with 2 additions and 3 deletions
|
@ -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
|
||||||
|
|
2
tests.py
2
tests.py
|
@ -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')
|
||||||
|
|
Loading…
Reference in a new issue