Welcome Guest, Not a member yet? Register   Sign In
Like button in my codeigniter website
#2

Even in the best-case (or worst-case, depending on your point of view) scenario, the page will get more reads than "likes", and, eventually, the majority of the people that will "like" the page will have done so. This definitely works in favor of the cache method.

If you're really concerned about excessive deletes in the cache, you could perform the write, but require a minimum age on the existing cache before it gets deleted. This would mean that the numbers might jump, especially under heavy load, and you would have to rely on JavaScript for people to see their "likes" counted immediately, but you wouldn't be constantly deleting the cache file and rebuilding it under heavy load. Plus, once things slow down, most of the "likes" would be immediately counted, since the cache file would be less likely to be fresh.

If you're concerned that a "like" may not be reflected on the page because of something odd (like two "like"s in a short time period with no activity afterwards), you could always have the cache rebuilt or deleted automatically on a schedule. You could even get more accurate by tracking when the relevant data was last changed and comparing that to when the cache file was built to determine whether the cache might be stale.
Reply


Messages In This Thread
RE: Like button in my codeigniter website - by mwhitney - 08-20-2015, 08:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB