Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal] Caching/saving timeline #2

Closed
Jaspur opened this issue Jul 21, 2013 · 5 comments
Closed

[Proposal] Caching/saving timeline #2

Jaspur opened this issue Jul 21, 2013 · 5 comments

Comments

@Jaspur
Copy link

Jaspur commented Jul 21, 2013

Hi, it takes a while now every time, because it has to check the Twitter server

@thujohn
Copy link
Collaborator

thujohn commented Jul 22, 2013

Hi.
It's a good idea.
Have you an idea how to implement this ?

@Jaspur
Copy link
Author

Jaspur commented Jul 22, 2013

Something like this:

$timeline = Twitter::getUserTimeline(array('screen_name' => 'jas_pur', 'count' => 3));
    if (Cache::has('twitter'))
        return Cache::get('twitter');
    else
        Cache::add('twitter', $timeline, 180);

@thujohn
Copy link
Collaborator

thujohn commented Jul 22, 2013

But if there are some tweets posted the cache won't return these...

@Jaspur
Copy link
Author

Jaspur commented Jul 22, 2013

See the documentation part of Cache in laravel. You can flush them, or keep the cache alive for some minutes. 
Gr., Jasper

Sent from Mailbox for iPhone

On Mon, Jul 22, 2013 at 6:10 PM, Jonathan Thuau notifications@github.com
wrote:

But if there are some tweets posted the cache won't return these...

Reply to this email directly or view it on GitHub:
#2 (comment)

@thujohn
Copy link
Collaborator

thujohn commented Jul 22, 2013

I will think of this for a next release.

For the moment you can do it in your controller.
Maybe more like this :

if (!Cache::has('twitter')){
    $timeline = Twitter::getUserTimeline(array('screen_name' => 'jas_pur', 'count' => 3));
    Cache::add('twitter', $timeline, 180);
}
return Cache::get('twitter');

@thujohn thujohn closed this as completed Jul 24, 2013
atymic added a commit that referenced this issue Nov 7, 2019
chore: travis config improvements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants