Hey all
First off, I'd like to start with this:
Where should you store page caches? Flat files or DB?
Secondly: What's the advantage of caching a page that is updated very frequently (e.g. fb) or a page that is customized to a single user?
Thanks![]()
Hey all
First off, I'd like to start with this:
Where should you store page caches? Flat files or DB?
Secondly: What's the advantage of caching a page that is updated very frequently (e.g. fb) or a page that is customized to a single user?
Thanks![]()
bernie1227 (03-11-2013)
Caching can be implemented in many ways. It trades more storage space for less processing.
What exactly are you trying to do? The answer will depend on that.
Depends on your goals. You might store cached information in the db if it's something that takes a lot to process (perhaps some accumulated value from calculating something about 50 entries). Or you might store a full HTML page as a file after generating it one time from the database.Where should you store page caches? Flat files or DB?
As an extreme example, if you're making images using PHP's GD library, you'd want to save those as files rather than re-process them each time-- that's a form of caching too.
Probably none. It might be a waste of space then. You need to use the cache more than 1 time for it to be useful. In fact, if the page is constantly being updated, the cache could be counterproductive-- it might stop the user from seeing the newest content (unless that's acceptable).Secondly: What's the advantage of caching a page that is updated very frequently (e.g. fb) or a page that is customized to a single user?
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
Hmmm... I remember a while ago Adrain says FB caches a lot... Adrian?![]()
bernie1227 (03-11-2013)
Facebook isn't cached, not entirely. But it certainly can use caching to save frequently accessed parts of the site.
Another option (something I've set up on one of my sites) is to check when the content was last updated (you need a "last updated" table in your database, or to save a date in your existing tables) then:
1. check if there is a cached version.
2. If so, is that cached version newer than the latest update?
3. If so, display it.
4. If no accurate cached version is found, re-process and save that in the cache.
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
Bookmarks