Added GetCacheStats
This commit is contained in:
@@ -680,5 +680,15 @@ namespace Discord
|
|||||||
RaiseOnLog(LogMessageSeverity.Verbose, LogMessageSource.Client, $"Config: {JsonConvert.SerializeObject(_config)}");
|
RaiseOnLog(LogMessageSeverity.Verbose, LogMessageSource.Client, $"Config: {JsonConvert.SerializeObject(_config)}");
|
||||||
_sentInitialLog = true;
|
_sentInitialLog = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void GetCacheStats(out int serverCount, out int channelCount, out int userCount, out int uniqueUserCount, out int messageCount, out int roleCount)
|
||||||
|
{
|
||||||
|
serverCount = _servers.Count;
|
||||||
|
channelCount = _channels.Count;
|
||||||
|
userCount = _users.Count;
|
||||||
|
uniqueUserCount = _globalUsers.Count;
|
||||||
|
messageCount = _messages.Count;
|
||||||
|
roleCount = _roles.Count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@ namespace Discord
|
|||||||
public TKey NewId { get; }
|
public TKey NewId { get; }
|
||||||
public CollectionItemRemappedEventArgs(TValue item, TKey oldId, TKey newId) { Item = item; OldId = oldId; NewId = newId; }
|
public CollectionItemRemappedEventArgs(TValue item, TKey oldId, TKey newId) { Item = item; OldId = oldId; NewId = newId; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public EventHandler<CollectionItemEventArgs> ItemCreated;
|
public EventHandler<CollectionItemEventArgs> ItemCreated;
|
||||||
private void RaiseItemCreated(TValue item)
|
private void RaiseItemCreated(TValue item)
|
||||||
{
|
{
|
||||||
@@ -54,6 +54,8 @@ namespace Discord
|
|||||||
protected readonly DiscordClient _client;
|
protected readonly DiscordClient _client;
|
||||||
protected readonly ConcurrentDictionary<TKey, TValue> _dictionary;
|
protected readonly ConcurrentDictionary<TKey, TValue> _dictionary;
|
||||||
|
|
||||||
|
public int Count => _dictionary.Count;
|
||||||
|
|
||||||
protected AsyncCollection(DiscordClient client, object writerLock)
|
protected AsyncCollection(DiscordClient client, object writerLock)
|
||||||
{
|
{
|
||||||
_client = client;
|
_client = client;
|
||||||
|
|||||||
Reference in New Issue
Block a user