cloudcreativity / laravel-json-api

JSON API (jsonapi.org) package for Laravel applications.
http://laravel-json-api.readthedocs.io/en/latest/
Apache License 2.0
778 stars 110 forks source link

Cache response in redis #569

Closed Suresh918 closed 3 years ago

Suresh918 commented 3 years ago

Do we have way to use redis cache along with json api for caching responses?

lindyhopchris commented 3 years ago

Hi!

No there's not one built into this package, because the caching logic is quite application specific. Plus also there's HTTP cache packages out there that could easily be made to work with your API. For example, this one should work: https://github.com/spatie/laravel-responsecache

lindyhopchris commented 3 years ago

Just as a follow up to this....

The purpose of this pacakge is to implement the JSON API specification. As the specification does not define caching, I have no plans to add caching to this package. The solution would be to use one of the available Laravel response cache packages, or implement application-specific logic e.g. via middleware.

If the JSON API spec did end up defining how caching should be done, then at that point it would make sense to add it to this package.