static int _m_TryUpdate(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Concurrent.ConcurrentDictionary <long, ulong> gen_to_be_invoked = (System.Collections.Concurrent.ConcurrentDictionary <long, ulong>)translator.FastGetCSObj(L, 1); { long _key = LuaAPI.lua_toint64(L, 2); ulong _newValue = LuaAPI.lua_touint64(L, 3); ulong _comparisonValue = LuaAPI.lua_touint64(L, 4); bool gen_ret = gen_to_be_invoked.TryUpdate( _key, _newValue, _comparisonValue); LuaAPI.lua_pushboolean(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
private void RefreshCache(int taskId) { if (!cacheDises.ContainsKey(taskId)) { cacheDises.TryAdd(taskId, new List <Model.Dispatch>()); } using (RLib.DB.DbConn dbconn = Pub.GetConn()) { var dispaths = dispatchdal.GetUnDispatchs(dbconn, taskId, cachePage, false); cacheDises.TryUpdate(taskId, dispaths, dispaths); } }
public void Register(string location) { Client client = null; if (RegisteredClients.TryGetValue(this.Context.ConnectionId, out client)) { Client updatedClient = new Client() { ConnectionId = this.Context.ConnectionId, Location = location }; RegisteredClients.TryUpdate(this.Context.ConnectionId, updatedClient, client); } else { client = new Client() { ConnectionId = this.Context.ConnectionId, Location = location }; RegisteredClients.TryAdd(this.Context.ConnectionId, client); } }
public bool TryUpdate(TKey key, TValue value, TValue comparison) { return(_dictionary.TryUpdate(key, value, comparison)); }