Forum OpenACS Development: Re: connection-global cache: namespace problem?

Collapse
Posted by Ola Hansson on
Okay. I think I am beginning to get this:

one HTTP request -> one connection -> one thread -> one interpreter ...

It now looks like what I should use to cache "per user" information is many global ns_caches (or nsv arrays); at least one per user who needs to have data cached (I could just suffix the collection name with $user_id to distinguish them), but it might make sense to split it up further based on what kind of data it is.

Is it better to have just a few big collections than to have many less big ones?

Global nscaches and nsv arrays seem to solve the exact same thing although ns_cache is probably a little faster since it's just a tcl API on top of a C module. AFAICT, ns_cache also provides better transaction control with less hassle.

Which method would folks recommend, and would you mind stating your reasons for your choice?

PS. Sorry Don. I didn't mean for it to sound like I doubted your suggestion of ns_cache...

Collapse
Posted by Tilmann Singer on
If you want to cache something per session (user) you might also want to look into ad_set_client_property and ad_get_client_property, with '-persistent f' set.