some fixes
This commit is contained in:
parent
58ec3d912b
commit
d132202662
2 changed files with 4 additions and 8 deletions
|
@ -129,14 +129,12 @@ App::init()
|
||||||
$useCache = $route->getLabel('cache', false);
|
$useCache = $route->getLabel('cache', false);
|
||||||
|
|
||||||
if ($useCache) {
|
if ($useCache) {
|
||||||
|
|
||||||
$key = md5($request->getURI() . implode('*', $request->getParams()));
|
$key = md5($request->getURI() . implode('*', $request->getParams()));
|
||||||
$cache = new Cache(new Filesystem(APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $project->getId()));
|
$cache = new Cache(new Filesystem(APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $project->getId()));
|
||||||
$timestamp = 60 * 60 * 24 * 30;
|
$timestamp = 60 * 60 * 24 * 30;
|
||||||
$data = $cache->load($key, $timestamp);
|
$data = $cache->load($key, $timestamp);
|
||||||
|
|
||||||
if (!empty($data)) {
|
if (!empty($data)) {
|
||||||
|
|
||||||
$cacheLog = Authorization::skip(fn() => $dbForProject->getDocument('cache', $key));
|
$cacheLog = Authorization::skip(fn() => $dbForProject->getDocument('cache', $key));
|
||||||
|
|
||||||
if ($cacheLog->isEmpty()) {
|
if ($cacheLog->isEmpty()) {
|
||||||
|
@ -159,12 +157,11 @@ App::init()
|
||||||
;
|
;
|
||||||
|
|
||||||
$route->setIsActive(false);
|
$route->setIsActive(false);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$response->addHeader('X-Appwrite-Cache', 'miss');
|
$response->addHeader('X-Appwrite-Cache', 'miss');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
App::init()
|
App::init()
|
||||||
->groups(['auth'])
|
->groups(['auth'])
|
||||||
|
@ -218,7 +215,7 @@ App::init()
|
||||||
throw new Exception('Unsupported authentication route', 501, Exception::USER_AUTH_METHOD_UNSUPPORTED);
|
throw new Exception('Unsupported authentication route', 501, Exception::USER_AUTH_METHOD_UNSUPPORTED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
App::shutdown()
|
App::shutdown()
|
||||||
->groups(['api'])
|
->groups(['api'])
|
||||||
|
@ -341,4 +338,4 @@ App::shutdown()
|
||||||
->setParam('networkResponseSize', $response->getSize())
|
->setParam('networkResponseSize', $response->getSize())
|
||||||
->submit();
|
->submit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -317,8 +317,7 @@ class DeletesV1 extends Worker
|
||||||
$this->deleteByGroup('sessions', [
|
$this->deleteByGroup('sessions', [
|
||||||
new Query('expire', Query::TYPE_LESSER, [$timestamp])
|
new Query('expire', Query::TYPE_LESSER, [$timestamp])
|
||||||
], $dbForProject);
|
], $dbForProject);
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue