> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alumio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cache requests

> Cache the request result for either a user specified time or the cache header value.

export const FormField = ({property, label, required = false, diType, uiPatterns, children}) => {
  const patterns = Array.isArray(uiPatterns) ? uiPatterns : uiPatterns ? [uiPatterns] : [];
  return <div style={{
    margin: '1.5rem 0'
  }}>
      <div style={{
    display: 'flex',
    alignItems: 'baseline',
    flexWrap: 'wrap',
    gap: '0.5rem',
    marginBottom: '0.25rem'
  }}>
        <strong>{label}</strong>
        <span style={{
    fontSize: '0.7rem',
    fontWeight: 600,
    textTransform: 'uppercase',
    letterSpacing: '0.04em',
    color: required ? '#6241f5' : '#6b7280'
  }}>
          {required ? 'Required' : 'Optional'}
        </span>
      </div>

      <div>{children}</div>

      {diType || patterns.length > 0 ? <p style={{
    fontSize: '0.85rem',
    color: '#6b7280',
    marginBottom: 0
  }}>
          {diType ? <>
              See the <a href={`/references/${diType}`}>{diType}</a> reference.{' '}
            </> : null}
          {patterns.length > 0 ? <>
              Accepts a <a href={`/documentation/placeholders-and-patterns/patterns#${patterns[0]}`}>pattern</a>.
            </> : null}
        </p> : null}
    </div>;
};

Stores the responses the connection receives so that repeated requests can be answered from the cache instead of hitting the server again. Use this when the same data is fetched often and does not change from one moment to the next, to cut down on calls to the remote service and speed things up. By default the connection follows the caching instructions the server sends back in its headers, but you can also set your own fixed lifetime for how long a response stays cached.

This documentation describes: [Schema](/schemas/http-client-plugin-configurator/cache)

## Fields

<FormField property="respect_cache_headers" label="Respect cache headers">
  An on/off toggle for whether the cache obeys the caching instructions the server returns (such as `no-cache`, `private`, `max-age`, and `no-store`). On by default. Turn it off to ignore those instructions and cache based only on the lifetime you set below.
</FormField>

<FormField property="default_ttl" label="Default ttl, in seconds">
  How long, in seconds, a response is kept in the cache when the server does not specify a lifetime of its own. Leave it empty to rely entirely on the server's instructions.
</FormField>

<FormField property="cache_lifetime" label="Cache lifetime when the server answers 304, in seconds">
  How long, in seconds, a cached response is kept after the server confirms it is still current (an HTTP 304 "Not Modified" reply). This lets a still-valid response stay cached without re-downloading it.
</FormField>

## Sample data

This plugin caches responses on a live connection rather than transforming integration data, so there is no before/after to show. The configuration below ignores the server's cache headers and keeps every response for one hour.

| Field                   | Value  |
| ----------------------- | ------ |
| Respect cache headers   | off    |
| Default ttl, in seconds | `3600` |

```json Configuration theme={null}
{
  "prototype": "cache",
  "parameters": {
    "respect_cache_headers": false,
    "default_ttl": 3600
  }
}
```
