API:Caching data/ar

التحكم في حفظ البيانات المؤقت من ناحية العميل
يسمح بروتوكول HTTP بالتحكم في الكيفية التي تحفظ بها متصفحات الإنترنت وبروكسيهات الوب المحتوى، وذلك عن طريق عدة قيم محددة في ترويسة. (هذا الأمر يعمل فقط مع طلبات GET.) تسمح واجهة برمجة التطبيقات للعميل ضبط قيمتين اثنين من بين هذه القيم، وهي  و  ، عن طريق متغيرات واجهة برمجة التطبيقات   و.

tells the browser how long the response should be cached (in seconds). does the same for shared proxies. In practice the latter is typically used to instruct the server-side reverse proxy (such as Wikimedia's ).

Errors are never cached. User-specific responses will be marked as  so the browser will cache them but public proxies won't. Currently the API uses a logged-in user's language setting by default, so responses to logged-in users are always private. This can be avoided by adding the  API parameter (T97096).

Improving cache hit ratio
A request is only served from cache if that exact URL has been cached. (E.g. if you make the same request with  and then with , the second won't be able to use the first's cache entry because the different   parameter makes the URL different.) If you pass a list of pages as a parameter, you might improve cache hit ratio by sorting and deduplicating them.

Controlling caching from an API module
Caching is specified by the  methods. Typically caching is only going to be a concern in the submodules, which should use   method instead, which they inherit from.