[wp-hackers] Caching tweets from twitter API with WordPress

Damian Jakusz-Gostomski damian.gostomski at googlemail.com
Mon Jan 23 22:06:54 UTC 2012


The transient API would be my immediate suggestion, but I think there might
be an edge case with it. (I've not used the transient API too much, so this
may not be true, but...)

If you set the expiration to be in 30 minutes, and the Twitter API goes
down for an hour, will it not delete the data after 30 minutes, leaving you
with nothing for the next 30 minutes?
A more robust way would probably be to do the caching part yourself using
options, and update it after the expiration *and* you fetch the latest
results.
That way, if something fails, you'll still have the cached data.


On 23 January 2012 21:52, Jeffrey Nolte <jnolte at getmoxied.net> wrote:

> Thanks Chip!  I think this should definitely do the trick.  I actually
> remember reading about this in the wrox Plugin-dev book.  I will reference
> this again.
>
> Thanks again!
>
> Jeff
> On Jan 23, 2012, at 4:47 PM, Chip Bennett wrote:
>
> > This sounds like an ideal candidate for the WordPress Transients
> > API<http://codex.wordpress.org/Transients_API>
> > .
> >
> > Chip
> >
> > On Mon, Jan 23, 2012 at 3:44 PM, Jeffrey Nolte <jnolte at getmoxied.net>
> wrote:
> >
> >> Hi WP Hackers,
> >>
> >> I am in the process of developing a plug-in that will cache tweets from
> >> the twitter API and serve the cached tweets if no new tweets are
> available
> >> or the Twitter service is out.  I was wondering if anyone can lend some
> >> best practice for this or some insight on a good way to approach this
> using
> >> the WordPress API.
> >>
> >> Thank you in advance,
> >>
> >> Jeffrey Nolte
> >>
> >> _______________________________________________
> >> wp-hackers mailing list
> >> wp-hackers at lists.automattic.com
> >> http://lists.automattic.com/mailman/listinfo/wp-hackers
> >>
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list