ICacheTable TKey  GetOrPut Method NFX Class Library

[This is preliminary documentation and is subject to change.]

Atomically tries to get object by key if it exists, otherwise calls a factory method under lock and puts the data with the specified parameters. 'newPutResult' returns the result of the put after factory method call. Keep in mind, that even if a factory method created a new object, there may be a case when the value could not be physically inserted in the cache because of a collision (data with higher priority occupies space and space is capped), so check for 'newPutResult' value which is null in case of getting an existing item. Returns object that was gotten or created anew

Namespace: NFX.ApplicationModel.Pile
Assembly: NFX (in NFX.dll) Version: 3.0.0.1 (3.0.0.1)
Syntax

Object GetOrPut(
	TKey key,
	Func<ICacheTable<TKey>, TKey, Object, Object> valueFactory,
	Object factoryContext,
	out Nullable<PutResult> newPutResult,
	int ageSec = 0,
	int putMaxAgeSec = 0,
	int putPriority = 0,
	Nullable<DateTime> putAbsoluteExpirationUTC = null
)

Parameters

key
Type: TKey
valueFactory
Type: OnlineSystem Func ICacheTable TKey , TKey, OnlineObject, OnlineObject 
factoryContext
Type: OnlineSystem Object
newPutResult
Type: OnlineSystem Nullable PutResult  
ageSec (Optional)
Type: OnlineSystem Int32
putMaxAgeSec (Optional)
Type: OnlineSystem Int32
putPriority (Optional)
Type: OnlineSystem Int32
putAbsoluteExpirationUTC (Optional)
Type: OnlineSystem Nullable OnlineDateTime 

Return Value

Type: OnlineObject
See Also