Skip cache slot when time-to-live is zero

If time-to-live is set to zero, we don't need to regenerate the cache
slots on every request. Instead, just skip the caching process and
immediately provide the dynamically generated version of the page.
Setting time-to-live to zero is useful when you want to disable caching
for certain pages.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2014-02-20 20:59:22 +01:00 committed by Jason A. Donenfeld
parent 8033dc01f4
commit 6ceba453a2
2 changed files with 15 additions and 9 deletions

View file

@ -343,7 +343,7 @@ int cache_process(int size, const char *path, const char *key, int ttl,
int result;
/* If the cache is disabled, just generate the content */
if (size <= 0) {
if (size <= 0 || ttl == 0) {
fn();
return 0;
}