Search Results for

Show / Hide Table of Contents

# Interface IIgnite

Main entry point for all Ignite APIs. You can obtain an instance of IIgnite through GetIgnite(), or for named grids you can use GetIgnite(String). Note that you can have multiple instances of IIgnite running in the same process by giving each instance a different name.

All members are thread-safe and may be used concurrently from multiple threads.

###### Namespace: Apache.Ignite.Core

###### Assembly: Apache.Ignite.Core.dll

##### Syntax

    public interface IIgnite : IDisposable

### Properties

#### Logger

Gets the logger.

See Logger for customization.

##### Declaration

    ILogger Logger { get; }

##### Property Value

Type | Description
--- | ---
ILogger |

#### Name

Gets the name of the grid this Ignite instance (and correspondingly its local node) belongs to. Note that single process can have multiple Ignite instances all belonging to different grids. Grid name allows to indicate to what grid this particular Ignite instance (i.e. Ignite runtime and its local node) belongs to.

If default Ignite instance is used, then `null` is returned. Refer to Ignition documentation for information on how to start named grids.

##### Declaration

    string Name { get; }

##### Property Value

Type | Description
--- | ---
System.String | Name of the grid, or `null` for default grid.

### Methods

#### AddCacheConfiguration(CacheConfiguration)

Adds cache configuration template. Name should contain *. Template settings are applied to a cache created with CreateCache<TK, TV>(String) if specified name matches the template name.

##### Declaration

    void AddCacheConfiguration(CacheConfiguration configuration)

##### Parameters

Type | Name | Description
--- | --- | ---
CacheConfiguration | configuration | Configuration.

#### CreateCache<TK, TV>(CacheConfiguration)

Dynamically starts new cache using provided configuration.

##### Declaration

    ICache<TK, TV> CreateCache<TK, TV>(CacheConfiguration configuration)

##### Parameters

Type | Name | Description
--- | --- | ---
CacheConfiguration | configuration | Cache configuration.

##### Returns

Type | Description
--- | ---
ICache<TK, TV> | Existing or newly created cache.

##### Type Parameters

Name | Description
--- | ---
TK | Cache key type.
TV | Cache value type.

#### CreateCache<TK, TV>(CacheConfiguration, NearCacheConfiguration)

Dynamically starts new cache using provided configuration.

##### Declaration

    ICache<TK, TV> CreateCache<TK, TV>(CacheConfiguration configuration, NearCacheConfiguration nearConfiguration)

##### Parameters

Type | Name | Description
--- | --- | ---
CacheConfiguration | configuration | Cache configuration.
NearCacheConfiguration | nearConfiguration | Near cache configuration for client.

##### Returns

Type | Description
--- | ---
ICache<TK, TV> | Existing or newly created cache.

##### Type Parameters

Name | Description
--- | ---
TK | Cache key type.
TV | Cache value type.

#### CreateCache<TK, TV>(CacheConfiguration, NearCacheConfiguration, PlatformCacheConfiguration)

Dynamically starts new cache using provided configuration.

##### Declaration

    ICache<TK, TV> CreateCache<TK, TV>(CacheConfiguration configuration, NearCacheConfiguration nearConfiguration, PlatformCacheConfiguration platformCacheConfiguration)

##### Parameters

Type | Name | Description
--- | --- | ---
CacheConfiguration | configuration | Cache configuration.
NearCacheConfiguration | nearConfiguration | Near cache configuration for client.
PlatformCacheConfiguration | platformCacheConfiguration | Platform cache configuration. Can be null. When not null, native .NET cache is created additionally.

##### Returns

Type | Description
--- | ---
ICache<TK, TV> | Existing or newly created cache.

##### Type Parameters

Name | Description
--- | ---
TK | Cache key type.
TV | Cache value type.

#### CreateCache<TK, TV>(String)

Dynamically starts new cache using template configuration.

##### Declaration

    ICache<TK, TV> CreateCache<TK, TV>(string name)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Cache name.

##### Returns

Type | Description
--- | ---
ICache<TK, TV> | Existing or newly created cache.

##### Type Parameters

Name | Description
--- | ---
TK | Cache key type.
TV | Cache value type.

#### CreateNearCache<TK, TV>(String, NearCacheConfiguration)

Starts a near cache on local client node if cache with specified was previously started. This method does not work on server nodes.

##### Declaration

    ICache<TK, TV> CreateNearCache<TK, TV>(string name, NearCacheConfiguration configuration)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | The name.
NearCacheConfiguration | configuration | The configuration.

##### Returns

Type | Description
--- | ---
ICache<TK, TV> | Near cache instance.

##### Type Parameters

Name | Description
--- | ---
TK | Cache key type.
TV | Cache value type.

#### CreateNearCache<TK, TV>(String, NearCacheConfiguration, PlatformCacheConfiguration)

Starts a near cache on local client node if cache with specified was previously started. This method does not work on server nodes.

##### Declaration

    ICache<TK, TV> CreateNearCache<TK, TV>(string name, NearCacheConfiguration configuration, PlatformCacheConfiguration platformConfiguration)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | The name.
NearCacheConfiguration | configuration | The configuration.
PlatformCacheConfiguration | platformConfiguration | Platform cache configuration. Can be null. When not null, native .NET cache is created additionally.

##### Returns

Type | Description
--- | ---
ICache<TK, TV> | Near cache instance.

##### Type Parameters

Name | Description
--- | ---
TK | Cache key type.
TV | Cache value type.

#### DestroyCache(String)

Destroys dynamically created (with CreateCache<TK, TV>(String) or GetOrCreateCache<TK, TV>(String)) cache.

##### Declaration

    void DestroyCache(string name)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | The name of the cache to stop.

#### GetAffinity(String)

Gets affinity service to provide information about data partitioning and distribution.

##### Declaration

    ICacheAffinity GetAffinity(string name)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Cache name.

##### Returns

Type | Description
--- | ---
ICacheAffinity | Cache data affinity service.

#### GetAtomicLong(String, Int64, Boolean)

Gets an atomic long with the specified name. Creates a new atomic long if it does not exist and `create` is true.

##### Declaration

    IAtomicLong GetAtomicLong(string name, long initialValue, bool create)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Name of the atomic long.
System.Int64 | initialValue | Initial value for the atomic long. Ignored if `create` is false.
System.Boolean | create | Flag indicating whether atomic long should be created if it does not exist.

##### Returns

Type | Description
--- | ---
IAtomicLong | Atomic long instance with the specified name, or null if it does not exist and `create` is `false`.

#### GetAtomicReference<T>(String, T, Boolean)

Gets an atomic reference with specified name from cache. Creates new atomic reference in cache if it does not exist and `create` is true.

##### Declaration

    IAtomicReference<T> GetAtomicReference<T>(string name, T initialValue, bool create)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Name of the atomic reference.
T | initialValue | Initial value for the atomic reference. Ignored if `create` is false.
System.Boolean | create | Flag indicating whether atomic reference should be created if it does not exist.

##### Returns

Type | Description
--- | ---
IAtomicReference<T> | Atomic reference instance with specified name, or null if it does not exist and `create` flag is not set.

##### Type Parameters

Name | Description
--- | ---
T |

##### Exceptions

Type | Condition
--- | ---
IgniteException | If atomic reference could not be fetched or created.

#### GetAtomicSequence(String, Int64, Boolean)

Gets an atomic sequence with specified name from cache. Creates new atomic sequence in cache if it does not exist and `create` is true.

##### Declaration

    IAtomicSequence GetAtomicSequence(string name, long initialValue, bool create)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Name of the atomic sequence.
System.Int64 | initialValue | Initial value for the atomic sequence. Ignored if `create` is false.
System.Boolean | create | Flag indicating whether atomic sequence should be created if it does not exist.

##### Returns

Type | Description
--- | ---
IAtomicSequence | Atomic sequence instance with specified name, or null if it does not exist and `create` flag is not set.

##### Exceptions

Type | Condition
--- | ---
IgniteException | If atomic sequence could not be fetched or created.

#### GetBinary()

Gets an instance of IBinary interface.

##### Declaration

    IBinary GetBinary()

##### Returns

Type | Description
--- | ---
IBinary | Instance of IBinary interface

#### GetCache<TK, TV>(String)

Gets the cache instance for the given name to work with keys and values of specified types.

You can get instances of ICache of the same name, but with different key/value types. These will use the same named cache, but only allow working with entries of specified types. Attempt to retrieve an entry of incompatible type will result in . Use GetCache<TK, TV>(String) in order to work with entries of arbitrary types.

##### Declaration

    ICache<TK, TV> GetCache<TK, TV>(string name)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Cache name.

##### Returns

Type | Description
--- | ---
ICache<TK, TV> | Cache instance for given name.

##### Type Parameters

Name | Description
--- | ---
TK | Cache key type.
TV | Cache value type.

#### GetCacheNames()

Gets the collection of names of currently available caches, or empty collection if there are no caches.

##### Declaration

    ICollection<string> GetCacheNames()

##### Returns

Type | Description
--- | ---
ICollection<System.String> | Collection of names of currently available caches.

#### GetCluster()

Gets an instance of ICluster interface.

##### Declaration

    ICluster GetCluster()

##### Returns

Type | Description
--- | ---
ICluster |

#### GetCompute()

Gets compute functionality over this grid projection. All operations on the returned ICompute instance will only include nodes from this projection.

##### Declaration

    ICompute GetCompute()

##### Returns

Type | Description
--- | ---
ICompute | Compute instance over this grid projection.

#### GetConfiguration()

Gets the configuration of this Ignite instance.

##### Declaration

    IgniteConfiguration GetConfiguration()

##### Returns

Type | Description
--- | ---
IgniteConfiguration |

#### GetDataRegionMetrics()

Gets a collection of memory metrics, one for each DataRegionConfigurations.

##### Declaration

    ICollection<IDataRegionMetrics> GetDataRegionMetrics()

##### Returns

Type | Description
--- | ---
ICollection<IDataRegionMetrics> |

#### GetDataRegionMetrics(String)

Gets the memory metrics for the specified data region.

To get metrics for the default memory region, use DefaultDataRegionName.

##### Declaration

    IDataRegionMetrics GetDataRegionMetrics(string dataRegionName)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | dataRegionName | Name of the data region.

##### Returns

Type | Description
--- | ---
IDataRegionMetrics |

#### GetDataStreamer<TK, TV>(String)

Gets a new instance of data streamer associated with given cache name. Data streamer is responsible for loading external data into Ignite. For more information refer to IDataStreamer<TK, TV> documentation.

##### Declaration

    IDataStreamer<TK, TV> GetDataStreamer<TK, TV>(string cacheName)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | cacheName | Cache name (`null` for default cache).

##### Returns

Type | Description
--- | ---
IDataStreamer<TK, TV> | Data streamer.

##### Type Parameters

Name | Description
--- | ---
TK |
TV |

#### GetEvents()

Gets events facade over all cluster nodes.

##### Declaration

    IEvents GetEvents()

##### Returns

Type | Description
--- | ---
IEvents | Events facade over all cluster nodes.

#### GetMemoryMetrics()

Gets a collection of memory metrics, one for each MemoryPolicies.

Memory metrics should be enabled with MetricsEnabled.

Obsolete, use GetDataRegionMetrics().

##### Declaration

    ICollection<IMemoryMetrics> GetMemoryMetrics()

##### Returns

Type | Description
--- | ---
ICollection<IMemoryMetrics> |

#### GetMemoryMetrics(String)

Gets the memory metrics for the specified memory policy.

To get metrics for the default memory region, use DefaultMemoryPolicyName.

Obsolete, use GetDataRegionMetrics(String).

##### Declaration

    IMemoryMetrics GetMemoryMetrics(string memoryPolicyName)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | memoryPolicyName | Name of the memory policy.

##### Returns

Type | Description
--- | ---
IMemoryMetrics |

#### GetMessaging()

Gets messaging facade over all cluster nodes.

##### Declaration

    IMessaging GetMessaging()

##### Returns

Type | Description
--- | ---
IMessaging | Messaging instance over all cluster nodes.

#### GetOrCreateCache<TK, TV>(CacheConfiguration)

Gets existing cache with the given name or creates new one using provided configuration.

##### Declaration

    ICache<TK, TV> GetOrCreateCache<TK, TV>(CacheConfiguration configuration)

##### Parameters

Type | Name | Description
--- | --- | ---
CacheConfiguration | configuration | Cache configuration.

##### Returns

Type | Description
--- | ---
ICache<TK, TV> | Existing or newly created cache.

##### Type Parameters

Name | Description
--- | ---
TK | Cache key type.
TV | Cache value type.

#### GetOrCreateCache<TK, TV>(CacheConfiguration, NearCacheConfiguration)

Gets existing cache with the given name or creates new one using provided configuration.

##### Declaration

    ICache<TK, TV> GetOrCreateCache<TK, TV>(CacheConfiguration configuration, NearCacheConfiguration nearConfiguration)

##### Parameters

Type | Name | Description
--- | --- | ---
CacheConfiguration | configuration | Cache configuration.
NearCacheConfiguration | nearConfiguration | Near cache configuration for client.

##### Returns

Type | Description
--- | ---
ICache<TK, TV> | Existing or newly created cache.

##### Type Parameters

Name | Description
--- | ---
TK | Cache key type.
TV | Cache value type.

#### GetOrCreateCache<TK, TV>(CacheConfiguration, NearCacheConfiguration, PlatformCacheConfiguration)

Gets existing cache with the given name or creates new one using provided configuration.

##### Declaration

    ICache<TK, TV> GetOrCreateCache<TK, TV>(CacheConfiguration configuration, NearCacheConfiguration nearConfiguration, PlatformCacheConfiguration platformCacheConfiguration)

##### Parameters

Type | Name | Description
--- | --- | ---
CacheConfiguration | configuration | Cache configuration.
NearCacheConfiguration | nearConfiguration | Near cache configuration for client.
PlatformCacheConfiguration | platformCacheConfiguration | Platform cache configuration. Can be null. When not null, native .NET cache is created additionally.

##### Returns

Type | Description
--- | ---
ICache<TK, TV> | Existing or newly created cache.

##### Type Parameters

Name | Description
--- | ---
TK | Cache key type.
TV | Cache value type.

#### GetOrCreateCache<TK, TV>(String)

Gets existing cache with the given name or creates new one using template configuration.

##### Declaration

    ICache<TK, TV> GetOrCreateCache<TK, TV>(string name)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Cache name.

##### Returns

Type | Description
--- | ---
ICache<TK, TV> | Existing or newly created cache.

##### Type Parameters

Name | Description
--- | ---
TK | Cache key type.
TV | Cache value type.

#### GetOrCreateLock(LockConfiguration, Boolean)

Gets or creates a distributed reentrant lock (monitor).

##### Declaration

    IIgniteLock GetOrCreateLock(LockConfiguration configuration, bool create)

##### Parameters

Type | Name | Description
--- | --- | ---
LockConfiguration | configuration | Lock configuration.
System.Boolean | create | Whether the lock should be created if it does not exist.

##### Returns

Type | Description
--- | ---
IIgniteLock | IIgniteLock

#### GetOrCreateLock(String)

Gets or creates a distributed reentrant lock (monitor) with default configuration.

##### Declaration

    IIgniteLock GetOrCreateLock(string name)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Lock name.

##### Returns

Type | Description
--- | ---
IIgniteLock | IIgniteLock

#### GetOrCreateNearCache<TK, TV>(String, NearCacheConfiguration)

Gets existing near cache with the given name or creates a new one.

##### Declaration

    ICache<TK, TV> GetOrCreateNearCache<TK, TV>(string name, NearCacheConfiguration configuration)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | The name.
NearCacheConfiguration | configuration | The configuration.

##### Returns

Type | Description
--- | ---
ICache<TK, TV> | Near cache instance.

##### Type Parameters

Name | Description
--- | ---
TK | Cache key type.
TV | Cache value type.

#### GetOrCreateNearCache<TK, TV>(String, NearCacheConfiguration, PlatformCacheConfiguration)

Gets existing near cache with the given name or creates a new one.

##### Declaration

    ICache<TK, TV> GetOrCreateNearCache<TK, TV>(string name, NearCacheConfiguration configuration, PlatformCacheConfiguration platformConfiguration)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | The name.
NearCacheConfiguration | configuration | The configuration.
PlatformCacheConfiguration | platformConfiguration | Platform cache configuration. Can be null. When not null, native .NET cache is created additionally.

##### Returns

Type | Description
--- | ---
ICache<TK, TV> | Near cache instance.

##### Type Parameters

Name | Description
--- | ---
TK | Cache key type.
TV | Cache value type.

#### GetPlugin<T>(String)

Gets the plugin by name.

##### Declaration

    T GetPlugin<T>(string name)
        where T : class

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Plugin name.

##### Returns

Type | Description
--- | ---
T | Plugin instance.

##### Type Parameters

Name | Description
--- | ---
T | Plugin type

##### Exceptions

Type | Condition
--- | ---
PluginNotFoundException | When plugin with specified name has not been found.

#### GetServices()

Gets services facade over all cluster nodes.

##### Declaration

    IServices GetServices()

##### Returns

Type | Description
--- | ---
IServices | Services facade over all cluster nodes.

#### GetTransactions()

Gets Ignite transactions facade.

##### Declaration

    ITransactions GetTransactions()

##### Returns

Type | Description
--- | ---
ITransactions |

#### GetVersion()

Gets Ignite version.

##### Declaration

    IgniteProductVersion GetVersion()

##### Returns

Type | Description
--- | ---
IgniteProductVersion | Ignite node version.

#### IsActive()

Determines whether this grid is in active state.

##### Declaration

    bool IsActive()

##### Returns

Type | Description
--- | ---
System.Boolean | `true` if the grid is active; otherwise, `false`.

#### ResetLostPartitions(IEnumerable<String>)

Clears partitions' lost state and moves caches to a normal mode.

##### Declaration

    void ResetLostPartitions(IEnumerable<string> cacheNames)

##### Parameters

Type | Name | Description
--- | --- | ---
IEnumerable<System.String> | cacheNames | Names of caches to reset partitions for.

#### ResetLostPartitions(String[])

Clears partitions' lost state and moves caches to a normal mode.

##### Declaration

    void ResetLostPartitions(params string[] cacheNames)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String[] | cacheNames | Names of caches to reset partitions for.

#### SetActive(Boolean)

Changes Ignite grid state to active or inactive.

##### Declaration

    void SetActive(bool isActive)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Boolean | isActive |

### Events

#### ClientDisconnected

Occurs when client node disconnects from the cluster. This event can only occur when this instance runs in client mode (ClientMode).

##### Declaration

    event EventHandler ClientDisconnected

##### Event Type

Type | Description
--- | ---
EventHandler |

#### ClientReconnected

Occurs when client node reconnects to the cluster. This event can only occur when this instance runs in client mode (ClientMode).

##### Declaration

    event EventHandler<ClientReconnectEventArgs> ClientReconnected

##### Event Type

Type | Description
--- | ---
EventHandler<ClientReconnectEventArgs> |

#### Stopped

Occurs when node has stopped. Node can't be used at this point. See also: AfterNodeStop.

##### Declaration

    event EventHandler Stopped

##### Event Type

Type | Description
--- | ---
EventHandler |

#### Stopping

Occurs when node begins to stop. Node is fully functional at this point. See also: BeforeNodeStop.

##### Declaration

    event EventHandler Stopping

##### Event Type

Type | Description
--- | ---
EventHandler |