diff --git a/src/Discord.Net.Core/Utils/Cacheable.cs b/src/Discord.Net.Core/Utils/Cacheable.cs
index b85536434..ff63e4c69 100644
--- a/src/Discord.Net.Core/Utils/Cacheable.cs
+++ b/src/Discord.Net.Core/Utils/Cacheable.cs
@@ -4,12 +4,29 @@ using System.Threading.Tasks;
namespace Discord
{
+ ///
+ /// Contains an entity that may be cached.
+ ///
+ /// The type of entity that is cached
+ /// The type of this entity's ID
public struct Cacheable
where TEntity : IEntity
where TId : IEquatable
{
+ ///
+ /// Is this entity cached?
+ ///
public bool HasValue => !EqualityComparer.Default.Equals(Value, default(TEntity));
+ ///
+ /// The ID of this entity.
+ ///
public ulong Id { get; }
+ ///
+ /// The entity, if it could be pulled from cache.
+ ///
+ ///
+ /// This value is not guaranteed to be set; in cases where the entity cannot be pulled from cache, it is null.
+ ///
public TEntity Value { get; }
private Func> DownloadFunc { get; }
@@ -20,11 +37,19 @@ namespace Discord
DownloadFunc = downloadFunc;
}
+ ///
+ /// Downloads this entity to cache.
+ ///
+ /// An awaitable Task containing the downloaded entity.
public async Task DownloadAsync()
{
return await DownloadFunc();
}
+ ///
+ /// Returns the cached entity if it exists; otherwise downloads it.
+ ///
+ /// An awaitable Task containing a cached or downloaded entity.
public async Task GetOrDownloadAsync() => HasValue ? Value : await DownloadAsync();
}
}
\ No newline at end of file