0

I've built a widget to output some fancy content from an API. I realize today I added a transient system so everytime the widget is updated transient is deleted and everything is alright.

What I missed is that the generated content is actually different according URL. So my system is not appropriate, for now the content remains the same on each post.

How would you handle this? I think one transient per post is bad bad idea, isn't it?

I could delete the transient code but this increase page load.

  • It depends on how many posts you have. If it's not too much then fine, but if it's loads then you might have to reconsider that approach. Also it might be best to just store the data for the widget in the transient rather than the entire widget itself because if you ever move to using object caching it will run out of memory quite quickly. – Steven Jones Apr 25 '14 at 11:07
  • I'm just storing the output. – JMau Apr 25 '14 at 14:24
0

I don't think a transient per post is a bad idea at all, and it's certainly more efficient than firing the API call on every load. Just be sure to give your transient name a unique name - maybe append the post ID to it.

  • ok then. I really thought it can blow ^^ – JMau Apr 24 '14 at 23:36
  • MySQL can take it. – vancoder Apr 24 '14 at 23:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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