As Web applications become more and more complex, cleverdevelopers can use application-level caching to improve the performanceof their PHP scripts. This article shows you how, discussing the PEARCache_Lite class with examples that illustrate how it can be used in alive environment.
According to one definition (http://www.nottm.edu.org.uk/techi/networks/caching.pdf), a cache "is a store of information that is designed to improve the accessibility or availability of data to the user." Simply put, it is a location where copies of information are kept so they can sent to the user quickly and without wastage of already scarce Internet resources.
Now, caches can be maintained at various levels depending on the requirements of the user. Unknown to many, the most commonly used caching mechanism is the Web browser itself. Modern Web browsers download content to a temporary location on the hard drive before rendering it to the user. And usually, if you visit the same page again, the browser will just pick it up from the local cache.
At a workplace, it's highly likely that you share your Internet connection with a large group of users. Here, the local cache of the Web browser does not always help to optimize the utilization of resources. In such a situation, network administrators often utilize the caching features of the proxy server used to share the Internet connection. This allows them to ensure that commonly-accessed sites are cached at the time of the first request. Subsequent requests to the same page are directly serviced from the proxy server's cache. Of course, this is not advisable for Web sites with highly dynamic content; proxy servers can be configured to avoid caching these pages.
The above caching mechanism is often replicated at different levels. It is not uncommon to find ISPs caching content in order to reduce traffic that might otherwise eat up precious bandwidth on the Internet backbones.
Finally, Web sites often implement complex caching mechanisms so as to serve their own content faster. This is the type of caching that this article discusses - caching your data at the application level. Keep reading.