emmett-framework / rest

REST extension for Emmett framework
BSD 3-Clause "New" or "Revised" License
14 stars 2 forks source link

Using cache #20

Closed josejachuf closed 1 year ago

josejachuf commented 1 year ago

Hi @gi0baro,

Is there any way to use cache without explicitly defining index and read methods?

gi0baro commented 1 year ago

@josejachuf I'm afraid not.

In my experience caching plays quite bad with RESTFul APIs, as the additional complexity needed to clear caches (every time you get a POST/PUT/DELETE you should clear the involved caches) generally makes it not worth the candle.

You can still define index and read one time in a custom RESTModule subclass and re-use it on all the modules you want the cache on.

josejachuf commented 1 year ago

I understand,. Thanks @gi0baro