protected override void Handle()

in src/Testing/Emulator/Policies/CacheLookupValueHandler.cs [23:51]


    protected override void Handle(GatewayContext context, CacheLookupValueConfig config)
    {
        var fromSetup = ValueSetup.Find(tuple => tuple.Item1(context, config))?.Item2;
        if (fromSetup is not null)
        {
            context.Variables[config.VariableName] = fromSetup;
            return;
        }

        var cachingType = config.CachingType ?? "prefer-external";


        var store = context.CacheStore.GetCache(cachingType);
        if (store is null)
        {
            return;
        }

        if (store.TryGetValue(config.Key, out var value))
        {
            context.Variables[config.VariableName] = value.Value;
            return;
        }

        if (config.DefaultValue is not null)
        {
            context.Variables[config.VariableName] = config.DefaultValue;
        }
    }