Search code examples
.netignite

How can I set ReadThrough and WriteThrough to CacheConfiguration via a thin client, and then create a Cache?(.net)


I have some special configurations, such as ReadThrough and WriteThrough that need to be set to CacheConfiguration, and then create multiple caches (with different names). I don't want to restart the Ignite service, and it seems that I can't do this through the thin client. How can I achieve this? (.net)

By some means, it is possible to dynamically set some properties, such as ReadThrough and WriteThrough, and dynamically initialize caches with different names.


Solution

  • You can create caches dynamically from thin client with IIgniteClient.CreateCache. However, CacheClientConfiguration does not provide a way to configure cache store and related properties (ReadThrough, WriteThrough), because code deployment is not allowed from the client.

    There are two ways around that.

    Cache Templates

    Define a cache template (cache configuration with * in the name, e.g. my-store-cache-*) in the server node configuration and set all store-related properties there.

    Then create caches from the thin client using client.CreateCache<K, V>("my-store-cache-123").

    Compute and Services

    Wrap cache creation logic in a compute job or a service, then call it from the thin client.