# Maximum Storage Lifetime

This feature allows users to configure the maximum lifetime for cookies and local storage entries set by JENTIS. Once a data entry's configured lifetime has expired, it will either be automatically removed by the browser (cookies) or removed by our script the next time a user accesses it (local storage).

**The Maximum lifetime can be configured on three levels:**

* Default set by JENTIS (730 days / 2 years)
* Global Default Customer setting, which is applicable for all containers of the JENTIS account
* Container level setting

We will always use the most specific setting when calculating the maximum lifetime. The lifetime limit is applied as soon as you publish your configuration.

<figure><img src="https://2315305008-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy15ncufYr341K5U8q6Of%2Fuploads%2Fgit-blob-67608c6cfc55d3dc652a674535b90d2487c4c7f0%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Important to note that this functionality only works with the JENTIS wrapper scripts that are provided with the JENTIS Web SDK.
{% endhint %}

{% code overflow="wrap" lineNumbers="true" %}

```javascript
window.jentis.helper.setCookie({
    "name": "test-lifetime-cookie",
    "value": "test-lifetime-cookie",
    "exdays": 1000,
    "sameSite": "Strict"
});

window.jentis.helper.setServerCookie({
    "name": "test-lifetime-server-cookie",
    "value": 'test-lifetime-server-cookie',
    "exdays": 1000 * 24 * 60 * 60 * 1000,
});

window.jentis.helper.setLocalStorageItem("test-lifetime-localstorage", "test-lifetime-localstorage", 1000 * 24 * 60 * 60 * 1000);


const cookie = window.jentis.helper.readCookie('test-lifetime-cookie');
const serverCookie = window.jentis.helper.readCookie('test-lifetime-server-cookie');
const localStorage = window.jentis.helper.getLocalStorageItem("test-lifetime-localstorage");
```

{% endcode %}

If you have any questions or suggestions, contact us through our [Helpdesk](https://jentis.atlassian.net/servicedesk/customer/portal/1/group/-1).
