JavaScript
Article

Twitter Tweet Cache Idea (Frontend)

By Sam Deering

This is a diagram for a system I developed to cache Twitter Tweets in JavaScript for fast loading. The call to fetch tweets from Twitter using oAuth REST API every x seconds with a since_id to prevent getting previously fetched tweets. The tweets are then returned from Twitter and displayed on the page. The load of x initial tweets are loaded and new tweets are loaded when the “x new tweets” button is clicked. There is also an infinite scroll which loads tweets directly from the tweet cache array and when this is exhausted is fetches older tweets from the API using the next_page property provided in the results of the API.

twitter-tweet-cache-frontend

No Reader comments

Recommended

Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

Get the latest in JavaScript, once a week, for free.