Tagged with Performance

Cache Function for PHP

This is a fantastic function that will allow you to cache your data. By default it will cache using memcache, however if you do not have memcache installed or a connection cannot be achieved it will fall back to file based cache.

The single function supports cache read, cache write, cache clear key and cache clear all. The cached data can be given an expirey time so that your data does not become stale.

Usage is very simple and the performance results of caching using memcache are fantastic.

Merge Your CSS and JavaScript Using PHP

Merge all of your CSS and JS into one file to improve server speed.

Apache Expires Headers with mod_expires

Quick example of how to set default expires headers. This will help prevent browsers from re-downloading the same images more than once and therefore reduce the load on your image server.

Image Cache using phpThumb and Mod_Rewrite

Generate thumbs by visiting a URL such as your.com/thumbs/50x50/images/image.jpg. This will create a 50x50px thumbnail of your.com/images/image.jpg.

The thumb will be stored on your server at your.com/thumbs/50x50/images/image.jpg so the next request for the same image will be loaded without loading php for ultra fast image cache.