Struct Cacheable<TEntity, TId>
Represents a cached entity.
Assembly: Discord.Net.Core.dll​
View Source​
Declaration
public struct Cacheable<TEntity, TId>
where TEntity : IEntity<TId> 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 TEntity Value { get; }
Methods​
DownloadAsync()​
Downloads this entity to cache.
View Source​
Declaration
public async Task<TEntity> DownloadAsync()
Returns​
System.Threading.Tasks.Task<<TEntity>>
:
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<TEntity> GetOrDownloadAsync()
Returns​
System.Threading.Tasks.Task<<TEntity>>
:
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.