"How does this work" >> well, if done properly
How to use cache ? Well, there are many types of solutions :
- caching parts of web pages (or even full pages) ; you can take a look at PEAR Cache_Lite (there are things like this in probably every existing frameworks ; there is in Zend Framework, with many backends supported)
- caching data (like objects, for instance) ; you can cache to files, to RAM (with APC for instance), to a caching server (like memcached, for instance)
- that data can come from many sources ; generally, it'll be from database, or a call to a webservice, or stuff like that
- that data will generally be something : often used, hard / long / costly to get
- you can also (not specific to PHP, though) use a reverse proxy (like varnish, for example) as a frontend to your web server, to cache entire HTML pages
The subject is really vast : there is almost an infinite number of possibilities...
But one thing to remember is : don't use caching "just to use caching" : caching, like anything else, can have drawbacks ; so use it if/when necessary...