Kentico REST api cache

Chibin Zhang asked on July 29, 2019 03:30

Hi, how does Kentico handle the REST service cache? In MVC we can retrieve content then cache them in the code if needed, but the REST service is provided by Kentico. Is Kentico handling it by default? Any configurations I need to do?

Thanks.

Correct Answer

Roman Hutnyk answered on July 29, 2019 10:15

Kentico caches a lot of data under the hood. To answer your question I'd like to know what data are you retrieving with REST service: * in case of pages - some or all data might got cached depending on Kentico settings (Settings -> System -> Performance) * if you're talking about custom table data - I believe it won't be cached by default

Actually it is quite easy to check - use Kentico SQL and/or Cache debug tools: * with SQL debug you'll see if Kentico runs SQL query for second request * with Cache debug you'll see what data get's cached

I'm not sure there is a way to configure caching for REST calls, so you might need to consider custom solution. There is an option to implement proxy API that will add any extra logic (caching in your case), but still will pass the request to Kentico REST API. See more details here.

1 votesVote for this answer Unmark Correct answer

Recent Answers


Peter Mogilnitski answered on July 29, 2019 17:55

If you have access to api there is no need in using rest service. Rest service is more for 3rd party applications to manage data using basic REST.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.