In my plugin, I am maintaining a cache of data that needs to be expired on a periodic basis.
I see that there are a couple of classes that could be useful…i.e. the Timer and TimerMgr
classes. However, I am not sure how they work. Would appreciate it if someone can point
me to some documentation on how to use them. Thanks.
Generally you need to derive your own timer class from Timer and
override the Dispatch() method. Then create an instance of your new
class and call timer_mgr->Add(instance). There are a few examples
across the code base, look for instance at the FileTimer in
src/file_analysis/FileTimer.h and how it is used in
File::ScheduleInactivityTimer() in src/file_analysis/File.cc
One note: You don't mention what type of plugin you are writing. If
you're adding a component that runs inside its own thread (log writer,
input reader), you cannot use the built-in timer machinery, as it's