# Configuration

Caching module requires serveral NuGet package installations. First you need to install **Eiffel.Caching.Extensions.DependencyInjection** package.

```sh
dotnet add package Eiffel.Caching.Extensions.DependencyInjection
```

{% hint style="info" %}
After the installation, **AddCaching** extension method will be accessible from `WebApplicationBuilder` class instance.
{% endhint %}

The Caching module provides distributed and in-memory caching options. The [`CacheSource`](/features/caching/api/cachesource.md) enum provides a list of supported cache sources

You can use the AddCaching method *without parameters*, but in that case, you must define the Caching section with the related source configuration in the appsettings.json file.

```csharp
// Program.cs (.NET5 and above)
public static async Task Main(string[] args)
{
    var builder = WebApplication.CreateBuilder(args);
    
    // Add caching
    builder.AddCaching();
     
    var app = builder.Build();
    app.Run();
}
```

Example **Redis** configuration section. For configuration details please [read](/features/caching/configuration/redis.md).

```json
{
    "Caching": {
        "Source": "Redis",
        "Redis": {
            ... // Put your redis configuration values here
        }
    }
}
```

Example **In-Memory** configuration section. For configuration details please [read](/features/caching/configuration/in-memory.md).

```json
{
    "Caching": {
        "Source": "InMemory",
        "InMemory": {
            ... // Put your in-memory configuration values here
        }
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.eiffel.dev/features/caching/configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
