Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Query building and caching expiration
  • Hi, I would like to know if there would be a way to give no expiration date to the cache created by the query builder. I tried null and false and the cache is simply not created. I would like this cache to never expire since it's data that will only change once a year. 

    This is the type of query I talk about.

    $response = $query->cached(false,$cache_path,false)->execute();

    Thanks
  • HarroHarro
    Accepted Answer
    The first parameter of cached() is the lifetime.

    For the Cache class, both null and false are valid values for lifetime (meaning "forever'' and "default"), but the cached() method checks for ! empty(), ruling both values out.

    Not that "never" is something else then "once a year". Perhaps just pass 86400*365 to it?

    Or check what happens if you remove the empty() check (in core/classes/database/qyery.php#L241) and you pass null or false. If that works, send a pull request on github, and become a Fuel contributor!
  • Ok yes I thought about putting the year's number of seconds. Ok i will give I a look and surely make a pull request if my fix is working. The more I will know FuelPhp, the more I will contribute! Thanks a lot !

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion