Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

What does WP have to offer when it comes to generating dynamic content that rarely changes?

I've created a jQuery backed metabox which implements auto complete and has the option of not allowing users to create new tags. (I want all my tags to be pre thought out and have associated descriptions.)

The tags themselves come from WP's built in functions. So without querying the database, it's difficult to know if tags have been added. Ideally, I'd only like to build the list when a new tag has been added and I'd only like to send them to the browser if absolutely necessary.

I can think of two methods to solve this:

  1. Hook the add new tag actions, build and save an xml file, then have my php script check the version and set the response headers. This introduces file system access issues which I'd like to avoid. Also not quite sure how to handle the version tracking though that isn't really WP related.

  2. Have the jQuery script make the request. The browser should in theory return the local cache if available. Then make a second request for the version and/or any new tags. This seems a little over the top.

Does WP have anything built in to handle this?

If WP doesn't have a cache system built in, perhaps it should. Plugins relying on third party plugins are not an option.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

WP has multiple caching APIs really. For caching of data, that can be easily rebuilt, Transients API is typically used.

However it's up to you how to architecture interaction with your script. WP exposes Ajax endpoint but its performance is questionable if you need extremely fast responses.

share|improve this answer
    
Funny you mention that. I'm right now reading up on the Transient API. I think this in combination with with the correct headers may do the job nicely. Infact, I wish I knew about it earlier. I'm gonna have to go back and rewrite some code. –  Waldermort Sep 21 '13 at 14:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.