Search code examples
c#outputcacheignite

IgniteOutputCacheProvider example, how to initialize this class?


I've just started using Apache Ignite for .NET. In particular I am trying to write an output cache for some web APIs using the following library:

Apache.Ignite.AspNet.IgniteOutputCacheProvider

Can anyone provide any example on how to Initialize this class?

This is the Initialize() function:

public override void Initialize(string name, NameValueCollection config)
    {
        base.Initialize(name, config);

        var cache = ConfigUtil.InitializeCache<string, object>(config, GetType(), null);

        _expiryCacheHolder = new ExpiryCacheHolder<string, object>(cache);
    }

I would like to see an example on how to use this WITHOUT using any xml file. I already have a running instance of Ignite, how can I pass it to this class?

Thank you.


Solution

  • If Ignite instance is running within the same process, then just use Ignition.GetIgnite() method to acquire it.

    If you mean that there are standalone server(s) running, then you still have to start an embedded client to connect to cluster using Ignition.Start(..). XML is not required, you can create configuration programmatically: https://apacheignite-net.readme.io/docs/configuration#c-code