Robust
Well-known member
So I'm working on something non-XF related. It's based on Laravel (PHP framework).
I have news articles and like to have view counts on them. What's the best way to go about it?
I was thinking, for logged in users each literal view is also a view onto the thing. For guests (non logged in users), a session is a view.
I'm not sure if I want to be calling the database to update this var on every page load. I was thinking perhaps save it into Laravel's cache, then every 30 minutes start a Laravel scheduler task to update the values from the cache into the database, then remove the key from the cache.
Pretty generically speaking, how do you advise going about view counts and saving them to the database? What does XF do?
I have news articles and like to have view counts on them. What's the best way to go about it?
I was thinking, for logged in users each literal view is also a view onto the thing. For guests (non logged in users), a session is a view.
I'm not sure if I want to be calling the database to update this var on every page load. I was thinking perhaps save it into Laravel's cache, then every 30 minutes start a Laravel scheduler task to update the values from the cache into the database, then remove the key from the cache.
Pretty generically speaking, how do you advise going about view counts and saving them to the database? What does XF do?