Stop any other transactions reading or writing this item to/from the cache. Send them straight to the database instead. (The lock does time out eventually.) This implementation tracks concurrent locks by transactions which simultaneously attempt to write to an item.

Namespace:  NHibernate.Cache
Assembly:  NHibernate (in NHibernate.dll)

Syntax

Visual Basic (Declaration)
Public Function Lock ( _
	key As CacheKey, _
	version As Object _
) As ISoftLock
C#
public ISoftLock Lock(
	CacheKey key,
	Object version
)
Visual C++
public:
virtual ISoftLock^ Lock(
	CacheKey^ key, 
	Object^ version
) sealed
JavaScript
function lock(key, version);

Parameters

key
Type: NHibernate.Cache..::.CacheKey
version
Type: System..::.Object

Implements

ICacheConcurrencyStrategy..::.Lock(CacheKey, Object)

See Also