Вот фрагмент кода:
Код: Выделить всё
$fitnetApi->slim->get('/users/{id}', function (Request $request, Response $response, $args) use ($class, $cache) {
$cacheKey = '/users/' . $args['id'];
if (empty($cache->get($cacheKey))) {
$cachedResponse = $cache->get($cacheKey);
$response->getBody()->write($cachedResponse);
return $response->withHeader('Content-Type', 'application/json');
}
$data = $class->container->get('userApi')->getUser($args['id']);
$response->getBody()->write($data);
$cache->add($cacheKey, $data);
return $response->withHeader('Content-Type', 'application/json');
});
ничего не возвращается в любом случае, но я не понимаю, в чем логическая ошибка
я использую https://github.com/SamNicholson/slimfilecache
Подробнее здесь: https://stackoverflow.com/questions/790 ... d-response