I’m pretty sure I want to implement more caching on FreshPorts. My first thought was to write the files to disk and then remove them when they need updating. I recall a caching program that either works with PostgreSQL is is implemented in PostgreSQL. Putting to cache into a database would be interesting. It’s not the retrieval time that is the bottleneck. It’s also the time to format the data into HTML.
Hopefully I’ll have time to code this soon.
Your file layout on freshports is very intelligent. I would suspect if you put your cache software (apache, or squid) in front, and added the correct expires header with php, you would notice considerable load taken from your database and web server.