Forum OpenACS Q&A: db_multirow -cache_key NOT recommended?

Collapse
Posted by Andrew Piskorski on
Wait, so using db_multirow with -cache_key is not recommended? In that case, what is the recommended scaleable way to cache the results from db_* API calls?

I'd already noticed that the DB API caching, although very handy, has some surprising limitations. In particular, I want to report how old a particular cached result is. OpenACS does not store that info at all, so I stored it myself in an ancillary nsv. But this isn't the best solution, because if the cache is flushed in the background, my nsv storing the cache create time does not know, and gets out of sync.

Also, in the log when NaviServer starts up, my OpenACS installation says it's "Using ns_cache based on NX 2.4.0". That comes from NaviServer's tcl/aolserver-openacs.tcl file, which it describes in a comment as a, "Minimal ns_cache implementation based on NX".

So this NX-based stuff is a backwards compatibility wrapper for old AOLserver ns_cache calls? And OpenACS still uses those old AOLserver-style calls, instead of the full ns_cache_* stuff built into NaviServer? Which cache API am I best off using for my own work going forward?