diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index bfc1ccba42..1135c2ab5e 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -1374,7 +1374,6 @@ App::post('/v1/functions/:functionId/variables') throw new Exception(Exception::VARIABLE_ALREADY_EXISTS); } - $dbForProject->deleteCachedDocument('functions', $function->getId()); $response ->setStatusCode(Response::STATUS_CODE_CREATED) @@ -1490,8 +1489,6 @@ App::put('/v1/functions/:functionId/variables/:variableId') throw new Exception(Exception::VARIABLE_ALREADY_EXISTS); } - $dbForProject->deleteCachedDocument('functions', $function->getId()); - $response->dynamic($variable, Response::MODEL_VARIABLE); }); @@ -1528,7 +1525,6 @@ App::delete('/v1/functions/:functionId/variables/:variableId') } $dbForProject->deleteDocument('variables', $variable->getId()); - $dbForProject->deleteCachedDocument('functions', $function->getId()); $response->noContent(); }); diff --git a/app/init.php b/app/init.php index d18752088b..45bf5c6806 100644 --- a/app/init.php +++ b/app/init.php @@ -411,6 +411,7 @@ Database::addFilter( return null; }, function (mixed $value, Document $document, Database $database) { + $database->deleteCachedDocument('functions', $document->getId()); return $database ->find('variables', [ Query::equal('functionInternalId', [$document->getInternalId()]),