Here are the examples of the csharp api System.Collections.Concurrent.ConcurrentDictionary.Clear() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
936 Examples
19
Source : CelesteNetMainComponent.cs
with MIT License
from 0x0ade
with MIT License
from 0x0ade
public void Cleanup() {
Player = null;
Session = null;
WasIdle = false;
WasInteractive = false;
foreach (Ghost ghost in Ghosts.Values)
ghost?.RemoveSelf();
Ghosts.Clear();
if (PlayerNameTag != null)
PlayerNameTag.Name = "";
if (PlayerIdleTag != null) {
PlayerIdleTag.PopOut = true;
PlayerIdleTag.AnimationTime = 1f;
}
}
19
Source : CelesteNetMainComponent.cs
with MIT License
from 0x0ade
with MIT License
from 0x0ade
public void Handle(CelesteNetConnection con, DataChannelMove move) {
if (move.Player.ID == Client.PlayerInfo.ID) {
foreach (Ghost ghost in Ghosts.Values)
ghost?.RemoveSelf();
Ghosts.Clear();
// The server resends all bound data anyway.
foreach (DataPlayerInfo other in Client.Data.GetRefs<DataPlayerInfo>()) {
if (other.ID == Client.PlayerInfo.ID)
continue;
foreach (DataType data in Client.Data.GetBoundRefs(other))
if (data.TryGet(Client.Data, out MetaPlayerPrivateState state))
Client.Data.FreeBoundRef(data);
}
} else {
if (!Ghosts.TryGetValue(move.Player.ID, out Ghost ghost) ||
ghost == null)
return;
ghost.RunOnUpdate(ghost => ghost.NameTag.Name = "");
Ghosts.TryRemove(move.Player.ID, out _);
foreach (DataType data in Client.Data.GetBoundRefs(move.Player))
if (data.TryGet(Client.Data, out MetaPlayerPrivateState state))
Client.Data.FreeBoundRef(data);
}
}
19
Source : SQLManager.cs
with MIT License
from 1100100
with MIT License
from 1100100
private void Initialize()
{
ReadXmlFiles(SqlCache);
ChangeToken.OnChange(() => FileProvider.Watch("**/*.xml"), () =>
{
Thread.Sleep(500);
try
{
ReadXmlFiles(SqlTempCache);
SqlCache.Clear();
foreach (var item in SqlTempCache)
{
SqlCache.TryAdd(item.Key, item.Value);
}
SqlTempCache.Clear();
}
catch (Exception ex)
{
Logger.LogError($"Sql separate xml file error:{ex.Message}");
SqlTempCache.Clear();
}
});
}
19
Source : Log4NetProvider.cs
with MIT License
from 1100100
with MIT License
from 1100100
public void Dispose()
{
_loggers.Clear();
}
19
Source : IClient.Default.cs
with MIT License
from 1100100
with MIT License
from 1100100
public async Task DisconnectAsync()
{
Logger.LogTrace($"Stopping client.[{Channel.LocalAddress}]");
foreach (var task in _resultCallbackTask.Values)
{
task.TrySetCanceled();
}
_resultCallbackTask.Clear();
if (Channel.Open)
{
await Channel.CloseAsync();
await EventLoopGroup.ShutdownGracefullyAsync(TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(1));
}
Logger.LogTrace($"The client[{Channel.LocalAddress}] has stopped.");
}
19
Source : ClientSideCaching.cs
with MIT License
from 2881099
with MIT License
from 2881099
public void Start()
{
_sub = _cli.Subscribe("__redis__:invalidate", InValidate) as IPubSubSubscriber;
_cli.Interceptors.Add(() => new MemoryCacheAop(this));
_cli.Unavailable += (_, e) =>
{
lock (_dictLock) _dictSort.Clear();
_dict.Clear();
lock (_clusterTrackingsLock)
{
if (_clusterTrackings.TryGetValue(e.Pool.Key, out var localTracking))
{
_clusterTrackings.Remove(e.Pool.Key);
localTracking.Client.Dispose();
}
}
};
_cli.Connected += (_, e) =>
{
var redirectId = GetOrAddClusterTrackingRedirectId(e.Host, e.Pool);
e.Client.ClientTracking(true, redirectId, null, false, false, false, false);
};
}
19
Source : ClientSideCaching.cs
with MIT License
from 2881099
with MIT License
from 2881099
long GetOrAddClusterTrackingRedirectId(string host, RedisClientPool pool)
{
var poolkey = pool.Key;
//return _sub.RedisSocket.ClientId;
if (_cli.Adapter.UseType != RedisClient.UseType.Cluster) return _sub.RedisSocket.ClientId;
ClusterTrackingInfo tracking = null;
lock (_clusterTrackingsLock)
{
if (_clusterTrackings.TryGetValue(poolkey, out tracking) == false)
{
tracking = new ClusterTrackingInfo
{
Client = new RedisClient(new ConnectionStringBuilder
{
Host = host,
MaxPoolSize = 1,
Preplacedword = pool._policy._connectionStringBuilder.Preplacedword,
ClientName = "client_tracking_redirect",
ConnectTimeout = pool._policy._connectionStringBuilder.ConnectTimeout,
IdleTimeout = pool._policy._connectionStringBuilder.IdleTimeout,
ReceiveTimeout = pool._policy._connectionStringBuilder.ReceiveTimeout,
SendTimeout = pool._policy._connectionStringBuilder.SendTimeout,
Ssl = pool._policy._connectionStringBuilder.Ssl,
User = pool._policy._connectionStringBuilder.User,
})
};
tracking.Client.Unavailable += (_, e) =>
{
lock (_dictLock) _dictSort.Clear();
_dict.Clear();
lock (_clusterTrackingsLock)
{
if (_clusterTrackings.TryGetValue(e.Pool.Key, out var localTracking))
{
_clusterTrackings.Remove(e.Pool.Key);
localTracking.Client.Dispose();
}
}
};
tracking.PubSub = tracking.Client.Subscribe("__redis__:invalidate", InValidate) as IPubSubSubscriber;
_clusterTrackings.Add(poolkey, tracking);
}
}
return tracking.PubSub.RedisSocket.ClientId;
}
19
Source : ClientSideCaching.cs
with MIT License
from 2881099
with MIT License
from 2881099
void InValidate(string chan, object msg)
{
if (msg == null)
{
//flushall
lock (_dictLock) _dictSort.Clear();
_dict.Clear();
return;
}
var keys = msg as object[];
if (keys != null)
{
foreach (var key in keys)
RemoveCache(string.Concat(key));
}
}
19
Source : IdleBus`1.cs
with MIT License
from 2881099
with MIT License
from 2881099
public void Dispose()
{
if (isdisposed) return;
lock (isdisposedLock)
{
if (isdisposed) return;
isdisposed = true;
}
foreach (var item in _removePending.Values) item.Dispose();
foreach (var item in _dic.Values) item.Dispose();
_removePending.Clear();
_dic.Clear();
_usageQuanreplacedy = 0;
}
19
Source : DbSet.cs
with MIT License
from 2881099
with MIT License
from 2881099
public void Dispose() {
if (_isdisposed) return;
try {
this._dicUpdateTimes.Clear();
this._states.Clear();
} finally {
_isdisposed = true;
GC.SuppressFinalize(this);
}
}
19
Source : DataFilter.cs
with MIT License
from 2881099
with MIT License
from 2881099
public void Dispose() {
_filters.Clear();
}
19
Source : DbSet.cs
with MIT License
from 2881099
with MIT License
from 2881099
public void FlushState() {
_states.Clear();
}
19
Source : SynchSubscribers.cs
with MIT License
from 3F
with MIT License
from 3F
public void Reset()
{
lock(sync)
{
listeners.Clear();
accessor.Clear();
}
}
19
Source : WorldDatabaseWithEntityCache.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public void ClearWeenieCache()
{
weenieCache.Clear();
weenieClreplacedNameToClreplacedIdCache.Clear();
weenieSpecificCachesPopulated = false;
}
19
Source : WorldDatabaseWithEntityCache.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public void ClearCachedLandblockInstances()
{
cachedLandblockInstances.Clear();
}
19
Source : WorldDatabaseWithEntityCache.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public void ClearSpellCache()
{
spellCache.Clear();
}
19
Source : WorldDatabaseWithEntityCache.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public void ClearWieldedTreasureCache()
{
cachedWieldedTreasure.Clear();
}
19
Source : FileDownloaderManager.cs
with MIT License
from Accelerider
with MIT License
from Accelerider
public void SuspendAll()
{
_observers.Values.ForEach(item => item.Dispose());
_observers.Clear();
_executingList.ForEach(item => item.Stop());
}
19
Source : NetworkSession.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public void ReleaseResources()
{
isReleased = true;
for (int i = 0; i < currentBundles.Length; i++)
currentBundles[i] = null;
outOfOrderPackets.Clear();
partialFragments.Clear();
outOfOrderFragments.Clear();
cachedPackets.Clear();
packetQueue.Clear();
ConnectionData.CryptoClient.ReleaseResources();
}
19
Source : GfxObjCache.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public static void Clear()
{
GfxObjs.Clear();
}
19
Source : LScape.cs
with GNU General Public License v3.0
from ACEmulator
with GNU General Public License v3.0
from ACEmulator
public static void unload_landblocks_all()
{
Landblocks.Clear();
}
19
Source : TraceManager.cs
with MIT License
from actions
with MIT License
from actions
private void Dispose(bool disposing)
{
if (disposing)
{
foreach (Tracing traceSource in _sources.Values)
{
traceSource.Dispose();
}
_sources.Clear();
}
}
19
Source : FileContainerServer.cs
with MIT License
from actions
with MIT License
from actions
private async Task<UploadResult> ParallelUploadAsync(RunnerActionPluginExecutionContext context, IReadOnlyList<string> files, int concurrentUploads, CancellationToken token)
{
// return files that fail to upload and total artifact size
var uploadResult = new UploadResult();
// nothing needs to upload
if (files.Count == 0)
{
return uploadResult;
}
// ensure the file upload queue is empty.
if (!_fileUploadQueue.IsEmpty)
{
throw new ArgumentOutOfRangeException(nameof(_fileUploadQueue));
}
// enqueue file into upload queue.
foreach (var file in files)
{
_fileUploadQueue.Enqueue(file);
}
// Start upload monitor task.
_uploadFilesProcessed = 0;
_uploadFinished = new TaskCompletionSource<int>();
_fileUploadTraceLog.Clear();
_fileUploadProgressLog.Clear();
Task uploadMonitor = UploadReportingAsync(context, files.Count(), _uploadCancellationTokenSource.Token);
// Start parallel upload tasks.
List<Task<UploadResult>> parallelUploadingTasks = new List<Task<UploadResult>>();
for (int uploader = 0; uploader < concurrentUploads; uploader++)
{
parallelUploadingTasks.Add(UploadAsync(context, uploader, _uploadCancellationTokenSource.Token));
}
// Wait for parallel upload finish.
await Task.WhenAll(parallelUploadingTasks);
foreach (var uploadTask in parallelUploadingTasks)
{
// record all failed files.
uploadResult.AddUploadResult(await uploadTask);
}
// Stop monitor task;
_uploadFinished.TrySetResult(0);
await uploadMonitor;
return uploadResult;
}
19
Source : VssConnection.cs
with MIT License
from actions
with MIT License
from actions
public void Dispose()
{
if (!m_isDisposed)
{
lock (m_disposeLock)
{
if (!m_isDisposed)
{
m_isDisposed = true;
foreach (var cachedType in m_cachedTypes.Values.Where(v => v is IDisposable).Select(v => v as IDisposable))
{
cachedType.Dispose();
}
m_cachedTypes.Clear();
Disconnect();
if (m_parentConnection != null)
{
m_parentConnection.Dispose();
m_parentConnection = null;
}
}
}
}
}
19
Source : SuppressionManager.FilesStore.cs
with GNU General Public License v3.0
from Acumatica
with GNU General Public License v3.0
from Acumatica
public void Clear() => _fileByreplacedembly.Clear();
19
Source : MemoryEventBusProvider.cs
with MIT License
from ad313
with MIT License
from ad313
public void Dispose()
{
ChannelProviderDictionary.Clear();
ErrorQueueDictionary.Clear();
QueueDictionary.Clear();
}
19
Source : NotificationUpdateManager.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
internal void CompleteEnreplacedyProcessing(Dictionary<string, string> updatedEnreplacedies, List<string> enreplacediesWithSuccessfulInvalidation, bool isSearchIndexInvalidation = false)
{
var timeStampTable = isSearchIndexInvalidation ? TimeStampTableForSearchIndex : TimeStampTableForCache;
//This Lock is For Sequential Execution
lock (mutexLock)
{
foreach (KeyValuePair<string, string> updatedEnreplacedy in updatedEnreplacedies)
{
// update the timestamp
if (enreplacediesWithSuccessfulInvalidation.Contains(updatedEnreplacedy.Key))
{
timeStampTable.AddOrUpdate(updatedEnreplacedy.Key, updatedEnreplacedy.Value, (enreplacedyname, timestamp) => updatedEnreplacedy.Value);
}
// remove from the processing table
EnreplacedyRecordMessage record;
this.ProcessingTable.TryRemove(updatedEnreplacedy.Key, out record);
ADXTrace.Instance.TraceInfo(TraceCategory.Application, string.Format("Updated Enreplacedy: {0} at Timestamp: {1} and cleared the MessageId:{2} from the Processing table.", updatedEnreplacedy.Key, updatedEnreplacedy.Value, record.MessageId));
}
// If an enreplacedy fails to get updated we should add it back to the dirty table
foreach (var keyValuePair in ProcessingTable)
{
ADXTrace.Instance.TraceWarning(TraceCategory.Application, string.Format("Failed to update the Enreplacedy: {0}. So adding MessageId: {1} back to the Dirty table.", keyValuePair.Key, keyValuePair.Value.MessageId));
// Any items left in processing table add back into Dirty table
var enreplacedyKey = string.Format(EnreplacedyKey, keyValuePair.Key,
isSearchIndexInvalidation ? FromSearchSubscription : FromCacheSubscription);
this.DirtyTable.TryAdd(enreplacedyKey, new EnreplacedyInvalidationMessageAndType(keyValuePair.Value, isSearchIndexInvalidation));
}
// Clear the Processing table
this.ProcessingTable.Clear();
}
}
19
Source : SharePointConfigurationManager.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
public static void Reset()
{
_connectionLookup.Clear();
_sharePointSection = null;
}
19
Source : DiscoveryService.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
internal static void Reset()
{
_config = null;
_configLookup.Clear();
_userTokenLookup.Clear();
}
19
Source : RestClient.cs
with MIT License
from Aiko-IT-Systems
with MIT License
from Aiko-IT-Systems
public void Dispose()
{
if (this._disposed)
return;
this._disposed = true;
this.GlobalRateLimitEvent.Reset();
if (this._bucketCleanerTokenSource?.IsCancellationRequested == false)
{
this._bucketCleanerTokenSource?.Cancel();
this.Logger.LogDebug(LoggerEvents.RestCleaner, "Bucket cleaner task stopped.");
}
try
{
this._cleanerTask?.Dispose();
this._bucketCleanerTokenSource?.Dispose();
this.HttpClient?.Dispose();
}
catch { }
this.RoutesToHashes.Clear();
this.HashesToBuckets.Clear();
this.RequestQueue.Clear();
}
19
Source : SubstrateClient.cs
with Apache License 2.0
from ajuna-network
with Apache License 2.0
from ajuna-network
protected virtual void Dispose(bool disposing)
{
if (!_disposedValue)
{
if (disposing)
{
new JoinableTaskFactory(new JoinableTaskContext()).Run(CloseAsync);
_connectTokenSource?.Dispose();
// dispose remaining request tokens
foreach (var key in _requestTokenSourceDict.Keys) key?.Dispose();
_requestTokenSourceDict.Clear();
_jsonRpc?.Dispose();
_socket?.Dispose();
Logger.Debug("Client disposed.");
}
// TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
// TODO: set large fields to null.
_disposedValue = true;
}
}
19
Source : SubstrateClient.cs
with Apache License 2.0
from ajuna-network
with Apache License 2.0
from ajuna-network
public async Task CloseAsync(CancellationToken token)
{
_connectTokenSource?.Cancel();
await Task.Run(() =>
{
// cancel remaining request tokens
foreach (var key in _requestTokenSourceDict.Keys) key?.Cancel();
_requestTokenSourceDict.Clear();
if (_socket != null && _socket.State == WebSocketState.Open)
{
_jsonRpc?.Dispose();
Logger.Debug("Client closed.");
}
});
}
19
Source : ObservableSourceGroupBy.cs
with Apache License 2.0
from akarnokd
with Apache License 2.0
from akarnokd
public void OnCompleted()
{
if (!done)
{
Volatile.Write(ref done, true);
foreach (var g in groups)
{
g.Value.OnCompleted();
}
groups.Clear();
downstream.OnCompleted();
}
}
19
Source : ObservableSourceGroupBy.cs
with Apache License 2.0
from akarnokd
with Apache License 2.0
from akarnokd
public void OnError(Exception ex)
{
if (!done)
{
Volatile.Write(ref done, true);
foreach (var g in groups)
{
g.Value.OnError(ex);
}
groups.Clear();
downstream.OnError(ex);
}
}
19
Source : FlowableGroupBy.cs
with Apache License 2.0
from akarnokd
with Apache License 2.0
from akarnokd
public void OnComplete()
{
if (Volatile.Read(ref done))
{
return;
}
foreach (var g in groups)
{
g.Value.OnComplete();
}
groups.Clear();
Volatile.Write(ref done, true);
Drain();
}
19
Source : FlowableGroupBy.cs
with Apache License 2.0
from akarnokd
with Apache License 2.0
from akarnokd
public void OnError(Exception cause)
{
if (Volatile.Read(ref done))
{
return;
}
foreach (var g in groups)
{
g.Value.OnError(cause);
}
groups.Clear();
this.error = cause;
Volatile.Write(ref done, true);
Drain();
}
19
Source : Archiver.cs
with MIT License
from AkiniKites
with MIT License
from AkiniKites
public void ClearCache()
{
_packFileLocator.Clear();
_packCache.Clear();
}
19
Source : Utility.cs
with MIT License
from aksyr
with MIT License
from aksyr
[BurstDiscard]
[Conditional("UNITY_MEDIA_MONITOR_NATIVE_ALLOCATIONS")]
public static void VerifyLeaks()
{
if (s_AllocationTracker == null || !EnableLeakTracking)
return;
foreach (KeyValuePair<Allocator, ConcurrentDictionary<long, long>> pair in s_AllocationTracker)
{
foreach (long memory in pair.Value.Keys)
Debug.LogWarning($"Unity.Media.Utilities: Leaked {memory:x} from allocator {pair.Key}");
pair.Value.Clear();
}
}
19
Source : ChannelPool.cs
with MIT License
from albyho
with MIT License
from albyho
protected virtual void Dispose(bool disposing)
{
if (_disposedValue)
return;
if (disposing)
{
// 1: 释放托管状态(托管对象)。
if (!_channels.Any())
{
_logger.LogDebug($"Disposed channel pool with no channels in the pool.");
return;
}
var poolDisposeStopwatch = Stopwatch.StartNew();
_logger.LogInformation($"Disposing channel pool ({_channels.Count} channels).");
var remainingWaitDuration = _totalDisposeWaitDuration;
foreach (var poolItem in _channels.Values)
{
var poolItemDisposeStopwatch = Stopwatch.StartNew();
try
{
poolItem.WaitIfInUse(remainingWaitDuration);
poolItem.Dispose();
}
catch
{
// ignored
}
poolItemDisposeStopwatch.Stop();
remainingWaitDuration = remainingWaitDuration > poolItemDisposeStopwatch.Elapsed
? remainingWaitDuration.Subtract(poolItemDisposeStopwatch.Elapsed)
: TimeSpan.Zero;
}
poolDisposeStopwatch.Stop();
_logger.LogInformation($"Disposed RabbitMQ Channel Pool ({_channels.Count} channels in {poolDisposeStopwatch.Elapsed.TotalMilliseconds:0.00} ms).");
if (poolDisposeStopwatch.Elapsed.TotalSeconds > 5.0)
{
_logger.LogWarning($"Disposing RabbitMQ Channel Pool got time greather than expected: {poolDisposeStopwatch.Elapsed.TotalMilliseconds:0.00} ms.");
}
_channels.Clear();
}
// 2: 释放未托管的资源(未托管的对象)并在以下内容中替代终结器。
// 3: 将大型字段设置为 null。
_disposedValue = true;
}
19
Source : ConnectionPool.cs
with MIT License
from albyho
with MIT License
from albyho
protected virtual void Dispose(bool disposing)
{
if (_disposedValue)
return;
if (disposing)
{
// 1: 释放托管状态(托管对象)。
foreach (var connection in _connections.Values)
{
try
{
connection.Dispose();
}
catch
{
// ignored
}
}
_connections.Clear();
}
// 2: 释放未托管的资源(未托管的对象)并在以下内容中替代终结器。
// 3: 将大型字段设置为 null。
_disposedValue = true;
}
19
Source : SuperIndexer.cs
with GNU General Public License v3.0
from alexdillon
with GNU General Public License v3.0
from alexdillon
public void EndTransaction()
{
Task.Run(async () =>
{
Debug.WriteLine("Ending Super Indexer Transaction...");
var result = this.WaitingOnGroupAndChatListings.WaitOne(TimeSpan.FromSeconds(10));
if (!result)
{
Debug.WriteLine("No group list available, loading new...");
var client = this.GroupsAndChats.FirstOrDefault()?.Client;
if (client == null)
{
return;
}
await client.GetGroupsAsync();
await client.GetChatsAsync();
this.GroupsAndChats = Enumerable.Concat<IMessageContainer>(client.Groups(), client.Chats());
}
this.OutdatedGroupIdList = this.CheckForOutdatedCache(this.GroupsAndChats);
Debug.WriteLine("Dirty groups computed, count " + this.OutdatedGroupIdList.Count);
using (var context = this.CacheManager.OpenNewContext())
{
// Update Group and Chat metadata in cache
if (DateTime.Now.Subtract(this.LastMetadataUpdate) > this.SettingsManager.CoreSettings.MetadataCacheInterval)
{
this.LastMetadataUpdate = DateTime.Now;
// Remove old metadata. Doing a removal and addition in the same cycle was causing
// OtherUserId foreign key for Chats to be null. Doing true updates with cascading deletes
// should be possible, but this can be done easily in SQLite without any further migrations (GMDC 33.0.3)
foreach (var metaData in this.GroupsAndChats)
{
if (metaData is Group groupMetadata)
{
var existing = context.GroupMetadata
.Include(g => g.Members)
.FirstOrDefault(g => g.Id == groupMetadata.Id);
if (existing != null)
{
foreach (var member in existing.Members)
{
context.Remove(member);
}
context.GroupMetadata.Remove(existing);
}
}
else if (metaData is Chat chatMetadata)
{
var existingChat = context.ChatMetadata.FirstOrDefault(c => c.Id == metaData.Id);
if (existingChat != null)
{
context.Remove(existingChat);
}
var existingMember = context.Find<Member>(chatMetadata.OtherUser.Id);
if (existingMember != null)
{
context.Remove(existingMember);
}
}
}
context.SaveChanges();
foreach (var addMetaData in this.GroupsAndChats)
{
context.Add(addMetaData);
}
context.SaveChanges();
}
// Process updates for each group and chat
var fullyUpdatedGroupIds = new List<string>();
foreach (var id in this.GroupUpdates.Keys)
{
var messages = this.GroupUpdates[id];
var groupState = context.IndexStatus.Find(id);
if (groupState == null)
{
// No cache status exists for this group. Force a full re-index.
}
else if (this.OutdatedGroupIdList.Contains(id))
{
var availableMessageIds = messages.Select(m => long.Parse(m.Id)).ToList();
var messageContainer = this.GroupsAndChats.FirstOrDefault(c => c.Id == id);
long.TryParse(groupState.LastIndexedId, out var lastIndexId);
if (availableMessageIds.Contains(lastIndexId))
{
// All new messages have already been loaded and are ready to index.
var newMessages = new List<Message>();
var newLastIndexId = lastIndexId;
foreach (var msg in messages)
{
if (long.TryParse(msg.Id, out var messageId) && messageId > lastIndexId)
{
newMessages.Add(msg);
if (messageId > newLastIndexId)
{
newLastIndexId = messageId;
}
}
}
context.AddMessages(newMessages);
groupState.LastIndexedId = newLastIndexId.ToString();
context.SaveChanges();
fullyUpdatedGroupIds.Add(id);
}
}
}
Debug.WriteLine("In place deltas applied, resolved " + fullyUpdatedGroupIds.Count);
// Preplaced 2, go through all originally outdated chats and run the complete re-index task on them
// if they couldn't be automatically updated with available messages.
foreach (var id in this.OutdatedGroupIdList)
{
if (!fullyUpdatedGroupIds.Contains(id))
{
var container = this.GroupsAndChats.FirstOrDefault(c => c.Id == id);
var cts = new CancellationTokenSource();
Debug.WriteLine("Full index scan required for " + container.Name);
// Don't start multiple overlapping indexing tasks.
var existingScan = this.TaskManager.RunningTasks.FirstOrDefault(t => t.Tag == id);
if (existingScan == null)
{
this.TaskManager.AddTask(
$"Indexing {container.Name}",
id,
this.IndexGroup(container, cts),
cts);
}
}
}
}
this.GroupUpdates.Clear();
this.WaitingOnGroupAndChatListings.Reset();
});
}
19
Source : Entity.cs
with MIT License
from AlternateLife
with MIT License
from AlternateLife
public void ClearData()
{
_data.Clear();
}
19
Source : FileLoggerProvider.cs
with MIT License
from angelsix
with MIT License
from angelsix
public void Dispose()
{
// Clear the list of loggers
mLoggers.Clear();
}
19
Source : RocksGraphProvider.cs
with MIT License
from angshuman
with MIT License
from angshuman
public void Dispose()
{
_logger.LogInformation("disposing rocksdb");
foreach (var pair in _dbs) {
pair.Value.Dispose();
}
_dbs.Clear();
}
19
Source : ThemeCache.cs
with MIT License
from AntonyCorbett
with MIT License
from AntonyCorbett
public void Purge()
{
_cache.Clear();
}
19
Source : NmsConnection.cs
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public async Task CloseAsync()
{
CheckIsOnDeliveryExecutionFlow();
if (closed.CompareAndSet(false, true))
{
DoStop(false);
foreach (NmsSession session in sessions.Values)
await session.ShutdownAsync(null).Await();;
try
{
await provider.CloseAsync().Await();;
}
catch (Exception)
{
Tracer.Debug("Ignoring provider exception during connection close");
}
sessions.Clear();
started.Set(false);
connected.Set(false);
}
}
19
Source : Awaiter.cs
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public void Dispose()
{
foreach (var item in _items.Values)
item.SetCanceled();
_items.Clear();
}
19
Source : Implementor.cs
with MIT License
from apexsharp
with MIT License
from apexsharp
public static void ResetToDefault()
{
ImplementationRepository.Clear();
}
19
Source : ChannelManagerCache.cs
with MIT License
from aprilyush
with MIT License
from aprilyush
public static void ClearChannels()
{
_channels.Clear();
}
19
Source : TemplateManagerCache.cs
with MIT License
from aprilyush
with MIT License
from aprilyush
public static void ClearTemplates()
{
_defaultTemplates[1] = new cms_template();
_defaultTemplates[2] = new cms_template();
_defaultTemplates[3] = new cms_template();
_templates.Clear();
}
See More Examples