If you’re using more and more macros on a page it’ll take longer and even longer to load the page, because the macros will be evaluated every time the page loads. First off, this is a nice thing because you’ll always have the latest content for the macro. But if your macros rely on a slow operation such as content from a webservice, you’ll have to trade speed for up-to-dateness.
You should consider implementing at least one of the following two options:
- adding WP Super Cache to your blog
- enabling a built-in cache for a macro
Although this might apply to a lot of plugins I’ll be talking about the WordPress BibSonomy plugin in detail.
Using WP Super Cache
Since I first enabled WP Super Cache for this site, I haven’t regretted it. Setting up the plugin is pretty easy and the results are great, so I strongly recommend this one.
Enable caching for a macro
Since WordPress doesn’t cache the contents of a macro itself I suggest every plugin that relies on a slow datasource should have some kind of caching.
To enable the cache for the WordPress BibSonomy plugin your webserver needs write access to the
cache directory that you can find in the plugins directory under
chmod 777 it and you’re all set.
Once you’ve set that up the results from the webservice will be stored in files on your server for super fast retrieval. This will speed things up significantly.
If you’re sending too many request to a webservice the worst thing that might happen is that you get banned and won’t be able to access it anymore. Since the macros will be evaluated every time a page loads by default you should implement some kind of caching for various reasons; speed being one of them.