Before i make a call to twitter, I check for the chache version of data. If there is no cache, then i create a connection with twitter.
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token, $access_token);
This is how i have planned to do. I haven't started it yet.
The question is :
Which is best way to do this?
1) Check for the cache, if there is no cache create a new connection and get details from twitter.
2) Create a new connection in top of every file ( or in a header ) check for cache, if there is no cache, (connection is already exists. so) get the details from twitter.
And, How do i check whether the connection ($connection) is active?