0

YQL Caching: _maxage url parameter works, but response.maxAge in the table doesnt?

Hi All,

Im trying to get yql to cache the results from my table for a couple of hours.

I have a little test table which just makes a y.query() to a webpage on my web server, and then outputs a value from that page. If i include the _maxage parameter in the url, it caches correctly, but I would like to get the same result without having to send the variable from the client-side.

Its stated that you can set this in your table by using setting the response.maxAge variable in the execute section of the table. I have done this, and there is no caching going on. Im just setting response.maxAge = 7200; at the top of the execute section, then executing a query, and dumping the results of the query into response.object. Am I doing something wrong?

Cheers

by
4 Replies
  • Hello?
    0
  • Hi Goaty,

    Are you doing something like this in your execute block: 

    var result = y.query(thequery);              
                      
    response.maxAge = 900; 
    response.object = result.results;


    If not, try that, if you are, post your execute block here.

    Thanks -Paul
    YQL Team
    0
  • Hi Paul,

    Thanks for helping.

    My current execute block:

    <execute>
    <![CDATA[  
      
      var result = y.query('select * from html where url="http://devsite12.brinkster.net/should_be_cached.html"');              
                      
      response.maxAge = 900; 
      response.object = result.results;
    ]]>
    </execute>

    The query just returns the HTML from that file - a h1 tag that says "Foo". Perfect. Now if i edit the html file and change the h1 to "Bar" - the table returns the new h1 tag "Bar". Should it not still be looking at the cache and return the old "Foo" content?

    Many thanks
    0
  • Odd. It does seem to work, as long as you don't have the diagnostics attribute set, and if testing in the yql console, even without diagnostics on, it seems to break the cache as well. Can you please confirm this is the case? Im a little wary that this might be an intermittent thing.
    0

Recent Posts

in YQL