Skip to content

Prevent storing cache objects if expire is non-positive (caching disable... #2947

wants to merge 1 commit into from

4 participants


This disables storing cache files if caching is disabled (expiry < 1).

SilverStripe Ltd. member
dhensby commented Mar 12, 2014
  1. Rather than duplicating the logic on line 174 it should be stored in a variable
  2. Also, is it really bad to store the cache if the lifetime is 0?

There could be some unexpected behaviour from this patch. Take this scenario:

$rest = new RestufService('');
$rest->request(); //first run, returns fresh data
$rest2 = new RestfulService('', 0);
$rest2->request(); //run before, but cache is 0 so returns fresh data
$rest3 = new RestufService('');
$rest3->request(); //returns same result as $rest->request();

//ie: $rest->request() == $rest3->request();

So, I think storing the last valid response isn't that bad; however, if you never use the cache, then you'll obviously be ending up with lots of files on the file system that you don't want; perhaps the solution is to be able to turn caching off completely?

@simonwelsh simonwelsh added the 3.1 label Mar 15, 2014
SilverStripe Ltd. member
halkyon commented Sep 25, 2014

No activity in a long time. Closing.

@halkyon halkyon closed this Sep 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.