This is a post for those who have a blur understanding about cache.

When we use the word cache there is no way of understanding which type of cache we referring to.

Here are a few different types of cache web developers use to make the website perform better and faster:

  • Browser Cache
  • Website Cache
  • Database Query Cache
  • XML/SEO Cache

Please do not jump into conclusion as each will be described below what they are and how they are used and can be useful.

Browser Cache

This simply means to simply cache the “response data” from the server to the browser, this is anything you can see on source code such as:

  • Images
  • HTML
  • CSS
  • JavaScript
  • Fonts

The reason for this is to help speed up the loading time of the page, if a file exists on a visitors computer it does not need to be re downloaded again browsers can just load that local file as oppose to the new file.

This is for each of the above points and possibly more.

Website Cache

Website cache is a method to save data to a special folder/directory on the website so when a requested URL is e.g.

If this has been cached, it just saves the trouble of restarting the whole process again…

So suppose many users visit the same page “events” in this case, why should we go and trigger database queries fetch files again etc… If the source code of the website has not changed, it’s just makes sense to save the source code for a particular page and refresh that cache every so often or when the content has changed.

By source code I don’t mean just the html, you can also cach the images just like timthumb does…

Database Queries

Again, suppose we have a page where we have a function that queries the database, and then we re-use this function to query the database again just so it can return the same information.

I suggest using PHP/ASP arrays to store each query, then you can check the array if that particular query has been triggered once, querying the database twice for the same query is not practical.

Using the in_array() function in PHP you can easily find out if a query is on this array, only if it’s not there you should be able to query the database. once the database has returned the information you should be able to push a new element to the array.


XML / SEO Cache is the term I wish to use for referring to the XML file which spiders/search engines, often use to get a sense of a sitemap.

Pushing any pages to the XML file should feed the search engine with new content or prompt it to re evaluate the page.

By this it does not mean that you will benefit from it… Search engines have rules, as long as you apply their rules to your files (do not cheat sooner or later your website will be punished once the cat and mouse game catches up with your website).

I will post a new post regarding SEO and my research regarding most web design/development techniques and to get the best out of a search engines.



Next time someone asks you to cache something, ask them what type of cache you are referring to.

I would recommend to use a method of pull and push,

Pull is a request to a resource e.g. database, a page, an image, a css file etc…

pull is what you get back from it, the returned data.

Pull/push – request/response – send/receive , All are the same thing.

So think about it each request/response takes time, sometimes this is insignificant in the sense of microseconds.

but accumulating this microseconds and this delays and creating back logs/queues eventually, something has to give, either time, or a crash either one is bad news for your website.

So my advice would be, have I made this request b4?
if so have I got a cached copy to serve?
if  yes => then serve the cached copy
if no => then create a cache and then serve the file [OR]  serve the file and cache whichever is more efficient

I hope it has been helpful advice, this is simply a method I would use and if you don’t think it’s practical for you then you should ignore the above and use your method, if you find it helpful we would like to hear from you, use the comment box below for this.