Chief Alchemist - Business Consulting For The 21st Century Via A Holistic & Intelligent Approach
Share ChiefAlchemist.com. RSS 2.0 feed for ChiefAlchemist.com. Sign up for the mailing list. Follow Chief Alchemist on Twitter. 'Like' the Chief Alchemist's page on Facebook. See what Chief Alchemist has been Q&A'ing on Quora. Chief Alchemist bookmarks & highlights on Diigo.com. Follow the Chief Alchemist on Digg.com. Chief Alchemist channel on Last.fm. Chief Alchemist on Flickr. Mark 'Chief Alchemist' Simchock on LinkedIn. Free Initial Consultation. Email Chief Alchemist. Phone Chief Alchemist.
  • Mark ‘Chief Alchemist’ Simchock
  • 'Email me.Email => ca .at. ChiefAlchemist .dot. com
  • 'Phone me.Alchemy United => 732 997-0028
  •  
  • Free initial consultation.Free => Initial Consultation
  • Please be sure to subscribe to your communication channels of choice.
  • Click To Close => The small green (consultation), red (email) or blue (phone) icons in the top upper right.
CURRENT “TOP 10” TOPICS TOOLS CLIENTS & PROJECTS SOURCES SEARCH HIDE
Business Consulting For The 21st Century Via A Holistic & Intelligent Approach

Product Launch: WPezClasses Transients Helpers 1

FYI => WordPress transients done The ezWay. Centralize your transients and treat them more like methods / functions.

https://github.com/WPezClasses/class-wp-ezclasses-transients-helpers-1

With this approach / structure, all—or at least most—of your transients can defined and managed via a single centralized class.

For example, most blog posts on how to use transients show the get, the if (i.e., is the transient value still available) and the recalculation (of the transient) all in the same spot, and quite possibly repeated throughout your code. Obviously, that gets messy. Additionally, chances are the logic / rules for the delete transients is elsewhere as well. Again, more possible disconnect.

With this new & improved approach (i.e., The ezWay), via a single static get all that is necessary is done for you. Well okay, you have to set it up, but the point is you do your get and these helpers enable the handling of the rest for you. Has the requested transient expired? No problem. You don’t need to know, nor do you care. You just need the value.

Or if the definition of the calculation for the value changes—say, a different WP_Query—you know exactly where to make that update. No more sprawl, or ideally a lot less.

You can also define when a transient should be deleted. For example, if a particular post_type is updated (i.e., action: save_post) you can have transients that lean on that update / post_type be deleted (indirectly) by that save_post event.

You can also “automate” the creation of transients that are based on post ID and user ID. Again, you define what you need and once that’s done all you have to really worry about is using the transient (via a static get).

Think less. Do more. The ezWay.

Required.
Will not be published. Required.
Please include http://