2009/6/8 Tewen Hsieh <tewen.hs...@itas.com.tw>:
> Loading the internal cache in the 'init_xxx()' routine is not fisable for my
> case, becaues my external data will be updated periodically.
> Also the loacl structure needs to be updated periodically.

OK - an alternative approach might be to run

    mib2c -Scache=1  -c mib2c.iterate.conf ....

This will generate code for the "iterate" helper instead,
which is similar to iterate_access (with the same get_first,next
hook routines).   The main difference is that it uses the
standard MIB handler routine, rather than individual routines
for each column object.

The reason for suggesting this (rather than iterate_access) is that
it includes support for "cached data" - i.e. loading the external
data separate from the iteration framework itself.

Now in itself, that doesn't get you any further forward, as it would
normally just load the external data when the first request comes
in (as currently), plus whenever the cached data is regarded as
"too old".   So you'd still have this long delay.

But it's also possible to run the reload routine automatically, on a
regular basis (perhaps in a separate thread), so that it's always
ready for incoming requests.

If you have a look at the 'agent/mibgroup/hardware/cpu' code,
that's the approach which is taken here.

Have a play with that - see if it's any better suited to your needs.

Dave

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to