# 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`](https://docs.eiffel.dev/features/caching/api/cachesource) 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](https://docs.eiffel.dev/features/caching/configuration/redis).

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

Example **In-Memory** configuration section. For configuration details please [read](https://docs.eiffel.dev/features/caching/configuration/in-memory).

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