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@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@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