# Cache Reserve ## Get Cache Reserve setting `cache.cache_reserve.get(CacheReserveGetParams**kwargs) -> CacheReserveGetResponse` **get** `/zones/{zone_id}/cache/cache_reserve` Increase cache lifetimes by automatically storing all cacheable files into Cloudflare's persistent object storage buckets. Requires Cache Reserve subscription. Note: using Tiered Cache with Cache Reserve is highly recommended to reduce Reserve operations costs. See the [developer docs](https://developers.cloudflare.com/cache/about/cache-reserve) for more information. ### Parameters - `zone_id: str` Identifier. ### Returns - `class CacheReserveGetResponse: …` - `id: CacheReserve` The identifier of the caching setting. - `"cache_reserve"` - `editable: bool` Whether the setting is editable. - `value: Literal["on", "off"]` Value of the Cache Reserve zone setting. - `"on"` - `"off"` - `modified_on: Optional[datetime]` Last time this setting was modified. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) cache_reserve = client.cache.cache_reserve.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(cache_reserve.id) ``` #### Response ```json { "errors": [], "messages": [], "result": { "editable": true, "id": "cache_reserve", "value": "off" }, "success": true } ``` ## Change Cache Reserve setting `cache.cache_reserve.edit(CacheReserveEditParams**kwargs) -> CacheReserveEditResponse` **patch** `/zones/{zone_id}/cache/cache_reserve` Increase cache lifetimes by automatically storing all cacheable files into Cloudflare's persistent object storage buckets. Requires Cache Reserve subscription. Note: using Tiered Cache with Cache Reserve is highly recommended to reduce Reserve operations costs. See the [developer docs](https://developers.cloudflare.com/cache/about/cache-reserve) for more information. ### Parameters - `zone_id: str` Identifier. - `value: Literal["on", "off"]` Value of the Cache Reserve zone setting. - `"on"` - `"off"` ### Returns - `class CacheReserveEditResponse: …` - `id: CacheReserve` The identifier of the caching setting. - `"cache_reserve"` - `editable: bool` Whether the setting is editable. - `value: Literal["on", "off"]` Value of the Cache Reserve zone setting. - `"on"` - `"off"` - `modified_on: Optional[datetime]` Last time this setting was modified. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.cache.cache_reserve.edit( zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) print(response.id) ``` #### Response ```json { "errors": [], "messages": [], "result": { "editable": true, "id": "cache_reserve", "value": "on" }, "success": true } ``` ## Get Cache Reserve Clear `cache.cache_reserve.status(CacheReserveStatusParams**kwargs) -> CacheReserveStatusResponse` **get** `/zones/{zone_id}/cache/cache_reserve_clear` You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation. ### Parameters - `zone_id: str` Identifier. ### Returns - `class CacheReserveStatusResponse: …` You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation. - `id: CacheReserveClear` ID of the zone setting. - `"cache_reserve_clear"` - `start_ts: datetime` The time that the latest Cache Reserve Clear operation started. - `state: State` The current state of the Cache Reserve Clear operation. - `"In-progress"` - `"Completed"` - `end_ts: Optional[datetime]` The time that the latest Cache Reserve Clear operation completed. - `modified_on: Optional[datetime]` Last time this setting was modified. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.cache.cache_reserve.status( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(response.id) ``` #### Response ```json { "errors": [], "messages": [], "result": { "end_ts": "2023-10-02T12:00:00.12345Z", "id": "cache_reserve_clear", "start_ts": "2023-10-02T10:00:00.12345Z", "state": "Completed" }, "success": true } ``` ## Start Cache Reserve Clear `cache.cache_reserve.clear(CacheReserveClearParams**kwargs) -> CacheReserveClearResponse` **post** `/zones/{zone_id}/cache/cache_reserve_clear` You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation. ### Parameters - `zone_id: str` Identifier. - `body: object` ### Returns - `class CacheReserveClearResponse: …` You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation. - `id: CacheReserveClear` ID of the zone setting. - `"cache_reserve_clear"` - `start_ts: datetime` The time that the latest Cache Reserve Clear operation started. - `state: State` The current state of the Cache Reserve Clear operation. - `"In-progress"` - `"Completed"` - `end_ts: Optional[datetime]` The time that the latest Cache Reserve Clear operation completed. - `modified_on: Optional[datetime]` Last time this setting was modified. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.cache.cache_reserve.clear( zone_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) print(response.id) ``` #### Response ```json { "errors": [], "messages": [], "result": { "id": "cache_reserve_clear", "start_ts": "2023-10-02T10:00:00.12345Z", "state": "In-progress" }, "success": true } ``` ## Domain Types ### Cache Reserve - `Literal["cache_reserve"]` The identifier of the caching setting. - `"cache_reserve"` ### Cache Reserve Clear - `Literal["cache_reserve_clear"]` ID of the zone setting. - `"cache_reserve_clear"` ### State - `Literal["In-progress", "Completed"]` The current state of the Cache Reserve Clear operation. - `"In-progress"` - `"Completed"` ### Cache Reserve Get Response - `class CacheReserveGetResponse: …` - `id: CacheReserve` The identifier of the caching setting. - `"cache_reserve"` - `editable: bool` Whether the setting is editable. - `value: Literal["on", "off"]` Value of the Cache Reserve zone setting. - `"on"` - `"off"` - `modified_on: Optional[datetime]` Last time this setting was modified. ### Cache Reserve Edit Response - `class CacheReserveEditResponse: …` - `id: CacheReserve` The identifier of the caching setting. - `"cache_reserve"` - `editable: bool` Whether the setting is editable. - `value: Literal["on", "off"]` Value of the Cache Reserve zone setting. - `"on"` - `"off"` - `modified_on: Optional[datetime]` Last time this setting was modified. ### Cache Reserve Status Response - `class CacheReserveStatusResponse: …` You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation. - `id: CacheReserveClear` ID of the zone setting. - `"cache_reserve_clear"` - `start_ts: datetime` The time that the latest Cache Reserve Clear operation started. - `state: State` The current state of the Cache Reserve Clear operation. - `"In-progress"` - `"Completed"` - `end_ts: Optional[datetime]` The time that the latest Cache Reserve Clear operation completed. - `modified_on: Optional[datetime]` Last time this setting was modified. ### Cache Reserve Clear Response - `class CacheReserveClearResponse: …` You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation. - `id: CacheReserveClear` ID of the zone setting. - `"cache_reserve_clear"` - `start_ts: datetime` The time that the latest Cache Reserve Clear operation started. - `state: State` The current state of the Cache Reserve Clear operation. - `"In-progress"` - `"Completed"` - `end_ts: Optional[datetime]` The time that the latest Cache Reserve Clear operation completed. - `modified_on: Optional[datetime]` Last time this setting was modified.