Open Chris-Peterson444 opened 1 year ago
I did a bit of digging:
CacheResolver
class sets the ETag header.CacheResolver
class is disabled / not used by default, when I tried to enable it, it breaks. It can't properly deserialize the eloquent models. (commented out in app.php:89)$app->routeMiddleware
function incorrectly. The docs says that the key should be the route you want that middleware to be activated for. (See: https://lumen.laravel.com/docs/9.x/middleware#registering-middleware)Also #318 introduces changes which would make the CacheResolver
class cache driver agnostic.
In the light of these I would say that caching is not there yet.
Also it would be nice to know @irfan-dahir which caching mechanism is which. I can see CacheResolver
and Microcaching
. Microcaching
only works when redis
is the cache driver. Why did you drop CacheResolver
?
CacheResolver
is from v3 where there's no database and everything is being cached on Redis.
Also, ETag from the code was removed because Nginx was supposed to be handling ETag. 😓
This should be resolvable from the master server directly. I'll look into it.
Microcaching only works when redis is the cache driver.
This should be fixed with #318 .
Also, ETag from the code was removed because Nginx was supposed to be handling ETag. 😓 This should be resolvable from the master server directly. I'll look into it.
Nevermind, it is not - just for static caching. Although I could've sworn it was handling it before with Nginx caching. 🤔
A fix for this would be an ETag middleware that handles comparing the Etag's (If-None-Match) hash with the controller's response hash since we are not just cashing responses now, we are querying it as well.
A fix for this would be an ETag middleware that handles comparing the Etag's (If-None-Match) hash with the controller's response hash since we are not just cashing responses now, we are querying it as well.
Watch out for this then: https://stackoverflow.com/questions/34238911/how-add-etag-header-on-json-response-in-laravel-lumen Also RoadRunner comes with an RFC7234 compliant cache driver which includes etags: https://roadrunner.dev/docs/middleware-cache/2.x/en Which also can be used to reduce caching related code in Jikan API. It also supports distributed caches if anyone would fancy running Jikan API on Kubernetes/Openshift/AWS ECS 🤣
It looks like the ETag information isn't getting returned in the response headers. I've checked a few different endpoints (
anime
,characters
, andmanga
) but it hasn't shown up in any of them.Minimum working example:
Which gives:
I would be happy to put some time in on starting a fix, but I'm a little new to the project (and PHP), so I could use some pointers on where to start looking to solve this.