[mythtv-users] Frontend services API question

Alex Tomlins alex at tomlins.org.uk
Wed Mar 18 22:07:33 UTC 2015


On 18/03/15 18:59, Hika van den Hoven wrote:
> Hoi Phil,
>
> Wednesday, March 18, 2015, 7:47:16 PM, you wrote:
>
> I have the same with the popups in the mythweb guide data. If I want
> to see fresh info after a mythfilldatabase run, I have to clear the
> browser cache. Possibly there is some kind of signal the browser
> checks on wether it can use the cache. A signal that mythweb doesn't
> give.

I've been seeing that as well, although I think it's unrelated (mythweb 
is a separate php application)...

I'm testing the following patch on my system which seems to improve it:

--- modules/tv/get_show_details.php.distrib    2014-10-04 
22:05:45.000000000 +0100
+++ modules/tv/get_show_details.php    2015-03-02 20:16:34.657089946 +0000
@@ -1,8 +1,8 @@
  <?php
  // Attempt to force some caching, will make secondary views so much 
faster.
-    header('Cache-Control: max-age-'.($_REQUEST['starttime'] - time() + 
604800));
+    header('Cache-Control: max-age=7200, public');
      header('Pragma: ');
-    header('Expires: '.date('D, d M Y H:i:s e', $_REQUEST['starttime'] 
+ 604800));
+    header('Expires: '.date('D, d M Y H:i:s e', time() + 7200));
      header('Content-Type: application/json');

      $program = load_one_program($_REQUEST['starttime'], 
$_REQUEST['chanid'], false);

This changes the cache headers for the ajax requests to be fixed at 2 
hours (7200 seconds).  Previously, they were set to the program 
starttime + 10 days, which is fine if your guide data never changes once 
it's been inserted, however often that's not the case...

Actually, given that's been running successfully for me for a while now, 
I'll look to submit this patch.

thanks,
Alex

-- 
Alex Tomlins
Email: alex at tomlins.org.uk

There are two kinds of people in the world: those who finish what they started



More information about the mythtv-users mailing list