The idea of caching is to keep a replicate of data where it is easier to reach than the original. Simply put caching could mean to keep a static copy of a web page that would otherwise be compiled together using a dynamic procedure (like PHP using a database back-end). By caching a copy to be served statically the overhead the dynamic procedure would otherwise create is eliminated.
A very simple cache procedure would consist of checking if there is already a cached copy of the requested material, if there is no already cached copy then it should create one. The second thing to take into consideration is how ‘fresh’ the currently cached copy is, all file systems today keep track of modification times on each file, comparing timestamps is sufficient enough for this. This very simple example does the previously mentioned checks and comparisons and you can try it out by accessing a cached copy of this post.
Since there is still some overhead when the client has to load the CSS and associated images the bandwidth saving is non-existent, the database load is totally eliminated however. I intend to work further on this caching code and make it object oriented and later on figure out how to make it save some bandwidth as well as database queries and execution time.