1
0
Fork 0
mirror of synced 2024-09-28 07:21:35 +12:00

some fixes

This commit is contained in:
shimon 2022-08-13 20:29:33 +03:00
parent 58ec3d912b
commit d132202662
2 changed files with 4 additions and 8 deletions

View file

@ -129,14 +129,12 @@ App::init()
$useCache = $route->getLabel('cache', false);
if ($useCache) {
$key = md5($request->getURI() . implode('*', $request->getParams()));
$cache = new Cache(new Filesystem(APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $project->getId()));
$timestamp = 60 * 60 * 24 * 30;
$data = $cache->load($key, $timestamp);
if (!empty($data)) {
$cacheLog = Authorization::skip(fn() => $dbForProject->getDocument('cache', $key));
if ($cacheLog->isEmpty()) {
@ -159,12 +157,11 @@ App::init()
;
$route->setIsActive(false);
} else {
$response->addHeader('X-Appwrite-Cache', 'miss');
}
}
});
});
App::init()
->groups(['auth'])
@ -218,7 +215,7 @@ App::init()
throw new Exception('Unsupported authentication route', 501, Exception::USER_AUTH_METHOD_UNSUPPORTED);
break;
}
});
});
App::shutdown()
->groups(['api'])
@ -341,4 +338,4 @@ App::shutdown()
->setParam('networkResponseSize', $response->getSize())
->submit();
}
});
});

View file

@ -317,8 +317,7 @@ class DeletesV1 extends Worker
$this->deleteByGroup('sessions', [
new Query('expire', Query::TYPE_LESSER, [$timestamp])
], $dbForProject);
}
);
});
}
/**