Skip to content

[FEATURE] Add WithOptions overload that supports resolving services via IServiceProvider #605

@petriceko

Description

@petriceko

Problem

We need to dynamically configure CacheKeyPrefix based on a service (ICachePrefixProvider) that may depend on runtime context (e.g., tenant, environment, or request-specific data).

Example

builder.Services.AddFusionCache()
    .WithOptions((sp, options) =>
    {
        var prefixProvider = sp.GetRequiredService<ICachePrefixProvider>();
        options.CacheKeyPrefix = prefixProvider.Prefix;
    })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions