[rules-users] Question about managing working memory facts

Zoltan Farkas zoly at daxtechnologies.com
Wed Feb 20 15:25:35 EST 2008


Thank you, I like the idea of doing this from a rule, my only concern would be the performance.

 

I was thinking on using an external queue that I would keep up to date by adding a working memory listener.

 

I read that the next release of drools might have some features that might deal better with this situation.

 

thanks

 

--zoly

 

 

________________________________

From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Edson Tirelli
Sent: Wednesday, February 20, 2008 12:37 PM
To: Rules Users List
Subject: Re: [rules-users] Question about managing working memory facts

 


   If you know what is the timestamp attribute, you can even write a rule... :)

rule "garbage collect"
    salience 100 // use a reasonable salience 
when
    $e : Event( $ts : timestamp )
    not Event( timestamp < $ts )
    Number( intValue > 1000 ) from accumulate( 
          $c : Event(),
          count( $c ) )
then
    $retract( $e );
end

   Not sure if it is the best way, but should work... :)

   []s
   Edson

2008/2/19, Zoltan Farkas <zoly at daxtechnologies.com>:

I am looking to implement a system that has as facts "events" that happen randomly.

 

How is the best way to implement a "garbage collection" mechanism that if the number of "events" in the working memory reaches a limit value will retract the oldest event/s.

 

Thanks

 

--zoly

 

 


_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




-- 
  Edson Tirelli
  JBoss Drools Core Development
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080220/d9a5c416/attachment.html 


More information about the rules-users mailing list