[rules-users] Efficiency of using inline evals in Drools 5

Nancy Dougherty nancyhd at stanford.edu
Tue Jul 28 03:21:43 EDT 2009


Hello!

I have a question about how an inline eval function is or isn’t
efficient in the algorithm-  I have many User objects that I am
inserting into Working Memory (in a stateful session), and each User
object has as ArrayList of Messages

The message class has 2 String fields: text and logid

I have custom boolean function user.containsText(String keyword)
function that takes in a string, and searches to see if that keyword
contained in the text field of one of the message entries in the User
message arraylist.  If I use an inline eval statement to implement
this:

$user: User( eval (containsText ( “sample text”) ) )

Will it re-evaluate each time?  Or will Drools cache the result and
remember it/ create a node based on it so the node will have every
user this is true for, and it doesn’t re-evaluate when the users or
rules are modified?  Will it create a "node" in the algorithm for all
the users that this function is true for?

On a similar note, if I use the “matches” comparator in a rule
creation, does it create a node and cache the result? Will it
automatically re-evaluate each time the field its matched against is
modified?

Thanks so much!

Nancy




More information about the rules-users mailing list