Struct Cacheable<TCachedEntity, TDownloadableEntity, TRelationship, TId>
Assembly: Discord.Net.Core.dll​
View Source​
Declaration
public struct Cacheable<TCachedEntity, TDownloadableEntity, TRelationship, TId>
where TCachedEntity : IEntity<TId>, TRelationship where TDownloadableEntity : IEntity<TId>, TRelationship where TId : IEquatable<TId>
Properties​
HasValue​
Gets whether this entity is cached.
View Source​
Declaration
public readonly bool HasValue { get; }
Id​
Gets the ID of this entity.
View Source​
Declaration
public readonly TId Id { get; }
Value​
Gets the entity if it could be pulled from cache.
View Source​
Declaration
public readonly TCachedEntity Value { get; }
Methods​
DownloadAsync()​
Downloads this entity.
View Source​
Declaration
public async Task<TDownloadableEntity> DownloadAsync()
Returns​
System.Threading.Tasks.Task<<TDownloadableEntity>>
:
A task that represents the asynchronous download operation. The task result contains the downloaded
entity.
GetOrDownloadAsync()​
Returns the cached entity if it exists; otherwise downloads it.
View Source​
Declaration
public async Task<TRelationship> GetOrDownloadAsync()
Returns​
System.Threading.Tasks.Task<<TRelationship>>
:
A task that represents the asynchronous operation that attempts to get the message via cache or to
download the message. The task result contains the downloaded entity.