What I'm trying to do is store some data about a user that we collect in cache (part of that data is output on every page they view). The data itself changes rarely (never more than hourly), so it seems like a waste to add a query to every page view to fetch it.
A couple ideas...
- JOIN in the data when we get the user data every page view via User_Model
- Not all users have the data (it's optional for them), so we can't read it from cache, and populate it if it's not there unless you started caching "dummy" entries... like "false" for people without data.
Not really excited about JOINing the user query run on every page because it would add two JOINs, and like I said... the data never changes more than hourly.
Also not terribly excited about tossing in thousands of cache entries with null data.
It would be nice if there was a way we could extend the XenForo_Session class so we could read the data into cache (or maybe even just store it in the session itself) when the session is first initialized, and then since we are the ones handling the data changing once in awhile, we could handle the updating of it in the cache/session when it's updated.
Anyone have any better ideas?