Tag: cache
Multisite PHP caching schema.
by jandrews on Mar.20, 2009, under PHP Development, Technology, Web Development
I am working on a website project. The website will have multiple domains/hosts pointing to it, and will have different themes for each domains/hosts that visit it. I want to give the site owners as much flexibility as possible with their layouts so that not everyone can have their own look. One problem that I see with giving them flexibility to change things is most of those things get stored in a database, and this is well and good but once the site starts to ramp up I expect there will be huge draws on server resources and database calls. Enter caching. I will admit I don’t have any experience writing a caching application. Symfony does it for you so Givvy has it, but not through my hands. Digibug had os-commerce, but I don’t think it cached anything really. Which explains why the CM Photocenter has so many performance issues. After researching php caching I can see 100 ways we could have increased performance on that site, and the same on the Digibug.
So I am researching, and everything I’ve read seems to be about the same, so now I am kind of at the point of “where and when to cache”. Not everything is going to be cache-able, but more importantly because I’ll have multiple sites pointing to the same server, I need a caching schema that caches based on the host that is being requested. This is my plan of action.
- Create a cached configuration file. This needs contain the basic information needed to connect to the database, and all the configuration items for that particular sites.
- Create cached items that are common on all pages. This includes page headers and footers. In different states
- Create cached items that won’t be updated often. Blog information. Gallery lists/thumbnail views. Event list pages
- Come up with a plan so that when something is updated in the database it regenerates the cache files, so the end user is not waiting.
I think it will help keep the big bad resource monsters at bay, allows some great customization abilities, and give me a good way to grow the site, I just need to think it through a bit more, decide which cache library I am going to use (or if I am going to roll my own), and figure out how to implement it. Lots of fun ahead. I have some ideas, and an entire weekend to play around with them :-p