GenericCacheTKey, TValueTryUpdate 方法

更新缓存项 仅当当前值与比较值相等时才更新为新值 此方法是原子操作,线程安全

Definition

命名空间: Suresking.Utility
程序集: Suresking.Utility (在 Suresking.Utility.dll 中) 版本:1.3.22+a27276bb8ffde055e69ff608e98aafba279e1e99
C#
public static bool TryUpdate(
	TKey key,
	TValue newValue,
	TValue comparisonValue
)

参数

key  TKey
要更新的缓存键
newValue  TValue
新值
comparisonValue  TValue
比较值,只有当当前值等于此值时才会更新

返回值

Boolean
如果更新成功返回true,否则返回false

参见