• Resolved jmvandeel

    (@jmvandeel)


    Hi,

    We are using this plugin as a church to show every Sunday morning a live stream on our website. And when no live stream is up, we show the playlist.

    Since our Live stream is always live on Sunday morning, I would like to explore a way to set the caching timer variable.
    When it is Sunday morning, check often when a live stream is available.
    but any other day in the week, just check once or twice a day and serve the playlist from cache.

    All this to reduce the API calls…

    Any suggestion how to build this?

    Can I use the filter my_ytl_custom_timeout’ in functions.php that you propose to achieve this?

    add_filter( 'wp_youtube_live_transient_timeout', 'my_ytl_custom_timeout' );
    function my_ytl_custom_timeout( $message ) {
        
        $now = new DateTime();
        $begin = new DateTime('8:00');
        $end = new DateTime('13:00');
    
        if(date('D') == 'Sun' && $now >= $begin && $now <= $end) {  
            return '15';
        }
        return '1500';
    }
    • This topic was modified 4 years, 5 months ago by jmvandeel.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Variable cache timing’ is closed to new replies.