MemProxy 0.1 is out! It has taken me a while, but I have finally gotten around to releasing the code that I credited with saving us during a Yahoo! mention. It is a caching proxy “server” that uses memcached for storing the cache. I put server in quotes because it is really just a PHP script that handles the caching and talking to the application servers. Apache and other HTTP servers already do a good job talking HTTP to a vast myriad of clients. I did not see any reason to reinvent the wheel. Here are some of the features that make it different from anything I could find:
- Uses memcached for storage
- Serves cache headers to clients based on TTL of cached data
- Uses custom headers to assemble multiple pieces of cache into one object
- Minimal dependencies. Only PHP and pecl/memcached needed.
- Small code base. It is just two files, one when settings are cached.
- Application agnostic. If the backend is hosted on an HTTP server this can cache it.
Some other things it does that you might expect:
- Handles HTTP 1.1 requests to the backend
- Allows TTLs set by the standard Cache-Control header
- Appears transparent to the client.
- Sends proper HTTP error codes relating to proxies/gateways
- Allows pages to be refreshed or removed from cache
- Allows a page to be viewed from the application server without caching it
You can find the code on Google Code. The code (or something like it rather) has been in use at dealnews for well over a year. But, this is a new code base. It had to be refactored for public consumption. So, there may be bugs.