Thanks so much for your help Liviu. In the end, I used the $shv() approach you suggested. It worked like a dream! :-)
In opensips.cfg: loadmodule "cfgutils.so" modparam("cfgutils", "shvset", "cacheValid=i:0") route{ if ($shv(cacheValid) == 0) { xlog("Reloading cache"); ...code to reload cached data goes here... $shv(cacheValid) = 1; } Trigger reload using opensips-cli: opensips-cli -x mi shv_set cacheValid int 0 On Wed, 25 Nov 2020 at 14:26, Liviu Chircu <li...@opensips.org> wrote: > On 25.11.2020 16:18, Mark Allen wrote: > > If the DB table is updated I can flush the cache of the old data with > > "opensips-cli -x mi cache_remove_chunk". I would then want to have a > > test in OpenSIPS that says that if the cache is empty, re-populate it > > from the DB. Is this possible? > > Hi, Mark! > > From my knowledge, the "cachedb is empty" test is not available right now. > > However, why not use either the recently added "raise_event" [1] > function, or even a shared $shv(cache_reset) variable [2] as a pure > "on/off" binary marker in order to hook into the opensips.cfg > environment via MI interface and then instruct OpenSIPS to do a > cache_remove_chunk() [3], followed by re-populating the cache? > > [1]: https://www.opensips.org/Documentation/Interface-CoreMI-3-2#toc20 > [2]: https://opensips.org/docs/modules/3.2.x/cfgutils.html#idp337920 > [3]: > > https://opensips.org/docs/modules/3.2.x/cachedb_local.html#func_cache_remove_chunk > > Best regards, > > -- > Liviu Chircu > www.twitter.com/liviuchircu | www.opensips-solutions.com > >
_______________________________________________ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users