logo

Lock Settings

Note
The information in this article applies only to ELMA 3.13.7 and higher.

Memory lock

If the distributed cache is not configured (only one ELMA server is used), the memory lock will be enabled by default after installing ELMA.

You can configure it manually, if necessary. To do so, edit the configuration file ../<ELMA directory>/UserConfig/configuration.config

1. Add these lines to the <configSections> section:

<section name="lock" type="EleWise.ELMA.Configuration.GenericProviderFeatureSection`1[[EleWise.ELMA.Locking.LockServiceManager, EleWise.ELMA.SDK]], EleWise.ELMA.SDK"/>
<section name="MemoryLockServiceSettings" type="EleWise.ELMA.Locking.MemoryLockServiceSettings, EleWise.ELMA.SDK"/>

2. Add these lines at the end of the configuration file:

<lock defaultProvider="memlock">
	  <providers>
		   <clear/>
		   <add name="dblock" type="EleWise.ELMA.Locking.MemoryLockService, EleWise.ELMA.SDK"/>
	  </providers>
</lock>

Attention!
The memory lock is not intended for web farms.

Database lock

If the distributed cache is configured (more than one ELMA server is used), the database lock will be enabled by default after installing ELMA.

You can configure it manually, if necessary. Edit the configuration file ../<ELMA directory>/UserConfig/configuration.config:

1. Add these lines to the <configSections> section:

<section name="lock" type="EleWise.ELMA.Configuration.GenericProviderFeatureSection`1[[EleWise.ELMA.Locking.LockServiceManager, EleWise.ELMA.SDK]], EleWise.ELMA.SDK"/>
<section name="DbDistributedLockServiceSettings" type="EleWise.ELMA.Locking.DbDistributedLockServiceSettings, EleWise.ELMA.SDK"/>

2. Add these lines at the end of the configuration file:

<lock defaultProvider="dblock">
	 <providers>
		  <clear/>
		  <add name="dblock" type="EleWise.ELMA.Locking.DbDistributedLockService, EleWise.ELMA.SDK"/>
	 </providers>
</lock>

Note that this lock can also be used for one ELMA server.

Redis lock

To store locks, you can also use the Redis network logged data storage. For this, you need at least three non-synchronized Redis servers. In this case, you must explicitly define that in the ELMA settings.

Edit the configuration file ../<ELMA directory>/UserConfig/configuration.config:

1. Add these lines to the <configSections> section:

<section name="lock" type="EleWise.ELMA.Configuration.GenericProviderFeatureSection`1[[EleWise.ELMA.Locking.LockServiceManager, EleWise.ELMA.SDK]], EleWise.ELMA.SDK"/>
<section name="RedisDistributedLockServiceSettings" type="EleWise.ELMA.DistributedLock.Redis.RedisDistributedLockServiceSettings, EleWise.ELMA.DistributedLock.Redis"/>

2. Add these lines at the end of the configuration file:

<lock defaultProvider="redis">
   <providers>
         <clear/>
         <add name="redis" type="EleWise.ELMA.DistributedLock.Redis.RedisDistributedLockService, EleWise.ELMA.DistributedLock.Redis"/>
   </providers>
</lock>
<RedisDistributedLockServiceSettings>
   <connections>
         <add connection="machine1:6379,password=your_redis_password"/>
         <add connection="machine2:6379,password=your_redis_password"/>
         <add connection="machine3:6379,password=your_redis_password"/>
   </connections>
</RedisDistributedLockServiceSettings>

where machine1:6379, machine2:6379 and machine3:6379 – are addresses and ports of Redis servers, and your_redis_password – are passwords to these servers.