[storm] how to refresh store.find( )

Eduardo Willians edujurista at gmail.com
Sat Jul 17 17:33:27 BST 2010


Well, this may look stupid, but here is.

I do:

number = store.find(Broker).max(Broker.number)

I get the number. But if another db connection adds a new row to DB,
and the code is run again:

number = store.find(Broker).max(Broker.number)

I get the SAME number instead of the new one was just added, because
storm's cache was not updated (I think).

There at least two solutions:

First:
store.commit()
number = store.find(Op).max(Op.number)
This is very dangerous because if there's any pending transaction it
will be committed to DB, so I can't use this.

Second:
store.rollback()
number = store.find(Op).max(Op.number)
This one is also dangerous, because if there's any pending transcation
waiting to be commited it will go away.

invalidate() and flush() does not work. And I think reset() is not recommended.

So, is there any other way to refresh store.find( )?



More information about the storm mailing list