Do not cache http responses on "ok" or "error" JSON responses
This commit is contained in:
parent
f89fde5c66
commit
01dbd06e8e
6
base.php
6
base.php
|
@ -57,9 +57,13 @@ function apiresult($data, $code=200) {
|
|||
header('Content-Type: application/json');
|
||||
}
|
||||
|
||||
if (isset($GLOBALS['http_cache_config']))
|
||||
if (isset($GLOBALS['http_cache_config'])
|
||||
&& gettype($data) !== 'string'
|
||||
&& !isset($data['error'])
|
||||
&& !isset($data['ok']))
|
||||
content_cache__put($GLOBALS['http_cache_config']['key'],
|
||||
'ondemand,'.$GLOBALS['http_cache_config']['seconds'], $data);
|
||||
|
||||
if (gettype($data) !== 'string')
|
||||
echo json_encode($data);
|
||||
else echo $data;
|
||||
|
|
Loading…
Reference in New Issue