CURL.SetOptionMaxLifeTimeConnection
-----------------------------------

Sets maximum lifetime (since creation) allowed for reusing a connection.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [CURL](component_CURL.md) | [12.4](newinversion124.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "CURL.SetOptionMaxLifeTimeConnection"; curl; Value ) 

**MBS**( **"CURL.SetOptionMaxLifeTimeConnection";** /\* Sets maximum lifetime (since creation) allowed for reusing a connection. \*/  
**$curl**; /\* The CURL session handle. \*/   
**$Value**) /\* The new maximum lifetime for a connection in seconds.e.g. 300 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| curl | The CURL session handle. | $curl |
| Value | The new maximum lifetime for a connection in seconds. | 300 |

### Result

Returns OK or error.

### Description

Sets maximum lifetime (since creation) allowed for reusing a connection.  
Pass a number as parameter containing maxlifetime - the maximum time in seconds, since the creation of the connection, that you allow an existing connection to have to be considered for reuse for this request.  
  
libcurl features a connection cache that holds previously used connections. When a new request is to be done, it will consider any connection that matches for reuse. The MaxLifeTimeConnection limit prevents libcurl from trying too old connections for reuse. This can be used for client-side load balancing. If a connection is found in the cache that is older than this set maxlifetime, it will instead be closed once any in-progress transfers complete.  
  
If set to 0, this behavior is disabled: all connections are eligible for reuse.  
### Release notes

- **Version 12.4**
    - Added [CURL.SetOptionMaxLifeTimeConnection](https://www.mbsplugins.eu/CURLSetOptionMaxLifeTimeConnection.shtml), [CURL.SetOptionMimeOptions](https://www.mbsplugins.eu/CURLSetOptionMimeOptions.shtml) and [CURL.SetOptionSSHHostPublicKeySHA256](https://www.mbsplugins.eu/CURLSetOptionSSHHostPublicKeySHA256.shtml) functions.

### Blog Entries

- [MBS FileMaker Plugin 12.4](https://www.mbsplugins.de/archive/2022-09-27/MBS_FileMaker_Plugin_124/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 12.4pr3](https://www.mbsplugins.de/archive/2022-08-24/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

Created 22nd August 2022 , last changed 22nd August 2022

  
[CURL.SetOptionMaxFileSize](CURLSetOptionMaxFileSize.md) - [CURL.SetOptionMaxRecvSpeed](CURLSetOptionMaxRecvSpeed.md)

[HTML Version](CURLSetOptionMaxLifeTimeConnection.shtml)