Wolfringo Wolfringo
Wolfringo Wolfringo
Wolfringo (c) 2020 TehGM
DocFX, DiscordFX theme.
Search Results for

    Class WolfClientCache

    Utility grouping common entity caches together.

    Inheritance
    System.Object
    WolfClientCache
    Implements
    IWolfClientCache
    IWolfClientCacheAccessor
    System.IDisposable
    Namespace: TehGM.Wolfringo.Caching.Internal
    Assembly: Wolfringo.Core.dll
    Syntax
    public class WolfClientCache : IWolfClientCache, IWolfClientCacheAccessor, IDisposable
    Remarks

    This utility contains caches for entities that Wolf client is caching.

    Each cache can be separately enabled or disabled.

    Constructors

    | Improve this Doc View Source

    WolfClientCache(ILogger)

    Creates new container and contained caches with all caches enabled.

    Declaration
    public WolfClientCache(ILogger log = null)
    Parameters
    Type Name Description
    Microsoft.Extensions.Logging.ILogger log

    Logger that this cache can log to. If null, logging will be disabled.

    Remarks

    All caches will be enabled by default.

    | Improve this Doc View Source

    WolfClientCache(WolfCacheOptions, ILogger)

    Creates new container and contained caches.

    Declaration
    public WolfClientCache(WolfCacheOptions options, ILogger log = null)
    Parameters
    Type Name Description
    WolfCacheOptions options

    Options specifying which caches should be enabled.

    Microsoft.Extensions.Logging.ILogger log

    Logger that this cache can log to. If null, logging will be disabled.

    | Improve this Doc View Source

    WolfClientCache(WolfCacheOptions, ILogger<WolfClientCache>)

    Creates new container and contained caches.

    Declaration
    public WolfClientCache(WolfCacheOptions options, ILogger<WolfClientCache> log)
    Parameters
    Type Name Description
    WolfCacheOptions options

    Options specifying which caches should be enabled.

    Microsoft.Extensions.Logging.ILogger<WolfClientCache> log

    Logger that this cache can log to. If null, logging will be disabled.

    Properties

    | Improve this Doc View Source

    AchievementsCache

    Achievements cache.

    Declaration
    protected IWolfCachedEntityCollection<WolfLanguage, WolfAchievement> AchievementsCache { get; }
    Property Value
    Type Description
    IWolfCachedEntityCollection<WolfLanguage, WolfAchievement>
    | Improve this Doc View Source

    CharmsCache

    Charms cache.

    Declaration
    protected IWolfCachedEntityCollection<WolfCharm> CharmsCache { get; }
    Property Value
    Type Description
    IWolfCachedEntityCollection<WolfCharm>
    | Improve this Doc View Source

    GroupsCache

    Groups cache.

    Declaration
    protected IWolfCachedEntityCollection<WolfGroup> GroupsCache { get; }
    Property Value
    Type Description
    IWolfCachedEntityCollection<WolfGroup>
    | Improve this Doc View Source

    IsAchievementsCachingEnabled

    Whether caching of WolfAchievement is enabled.

    Declaration
    public bool IsAchievementsCachingEnabled { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsCharmsCachingEnabled

    Whether caching of WolfCharm is enabled.

    Declaration
    public bool IsCharmsCachingEnabled { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsGroupsCachingEnabled

    Whether caching of WolfGroup is enabled.

    Declaration
    public bool IsGroupsCachingEnabled { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsUsersCachingEnabled

    Whether caching of WolfUser is enabled.

    Declaration
    public bool IsUsersCachingEnabled { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Log

    A logger for logging messages.

    Declaration
    protected ILogger Log { get; }
    Property Value
    Type Description
    Microsoft.Extensions.Logging.ILogger
    | Improve this Doc View Source

    UsersCache

    Users cache.

    Declaration
    protected IWolfCachedEntityCollection<WolfUser> UsersCache { get; }
    Property Value
    Type Description
    IWolfCachedEntityCollection<WolfUser>

    Methods

    | Improve this Doc View Source

    Clear()

    Clears all caches.

    Declaration
    public virtual void Clear()
    | Improve this Doc View Source

    GetCachedAchievement(WolfLanguage, UInt32)

    Get achievement from cache.

    Declaration
    public WolfAchievement GetCachedAchievement(WolfLanguage language, uint id)
    Parameters
    Type Name Description
    WolfLanguage language

    Language of achievement's translations.

    System.UInt32 id

    ID of the achievement.

    Returns
    Type Description
    WolfAchievement

    Cached achievement if found in requested language; otherwise null.

    | Improve this Doc View Source

    GetCachedCharm(UInt32)

    Get charm from cache.

    Declaration
    public WolfCharm GetCachedCharm(uint id)
    Parameters
    Type Name Description
    System.UInt32 id

    ID of the charm.

    Returns
    Type Description
    WolfCharm

    Cached charm if found; otherwise null.

    | Improve this Doc View Source

    GetCachedGroup(String)

    Get group from cache.

    Declaration
    public WolfGroup GetCachedGroup(string name)
    Parameters
    Type Name Description
    System.String name

    Name of the group.

    Returns
    Type Description
    WolfGroup

    Cached group if found; otherwise null.

    | Improve this Doc View Source

    GetCachedGroup(UInt32)

    Get group from cache.

    Declaration
    public WolfGroup GetCachedGroup(uint id)
    Parameters
    Type Name Description
    System.UInt32 id

    ID of the group.

    Returns
    Type Description
    WolfGroup

    Cached group if found; otherwise null.

    | Improve this Doc View Source

    GetCachedUser(UInt32)

    Get user from cache.

    Declaration
    public WolfUser GetCachedUser(uint id)
    Parameters
    Type Name Description
    System.UInt32 id

    ID of the user.

    Returns
    Type Description
    WolfUser

    Cached user if found; otherwise null.

    | Improve this Doc View Source

    LogWarning(String, Object[])

    Logs message with Warning level, and returns true.

    Declaration
    protected bool LogWarning(string message, params object[] args)
    Parameters
    Type Name Description
    System.String message

    Log message template.

    System.Object[] args

    Structured log message arguments.

    Returns
    Type Description
    System.Boolean

    True.

    Remarks

    Designed to use with catch (Exception) when pattern. Preserves log scope for logged message.

    | Improve this Doc View Source

    OnConnectingAsync(IWolfClient, CancellationToken)

    Invoked when client is about to connect to the server.

    Declaration
    public virtual Task OnConnectingAsync(IWolfClient client, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    IWolfClient client

    WOLF client that is connecting to the server.

    System.Threading.CancellationToken cancellationToken

    Cancellation token that can be used for Task cancellation.

    Returns
    Type Description
    System.Threading.Tasks.Task
    | Improve this Doc View Source

    OnDisconnected(IWolfClient, SocketClosedEventArgs)

    Invoked when the client has disconnected from the server.

    Declaration
    public virtual void OnDisconnected(IWolfClient client, SocketClosedEventArgs e)
    Parameters
    Type Name Description
    IWolfClient client

    WOLF client that has disconnected from the server.

    SocketClosedEventArgs e

    Event args raised when connection was closed.

    | Improve this Doc View Source

    OnMessageReceivedAsync(IWolfClient, IWolfMessage, SerializedMessageData, CancellationToken)

    Handle message received from the server.

    Declaration
    public virtual async Task OnMessageReceivedAsync(IWolfClient client, IWolfMessage message, SerializedMessageData rawMessage, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    IWolfClient client

    WOLF client that received the message.

    IWolfMessage message

    Received message.

    SerializedMessageData rawMessage

    Raw received message.

    System.Threading.CancellationToken cancellationToken

    Cancellation token that can be used for Task cancellation.

    Returns
    Type Description
    System.Threading.Tasks.Task
    | Improve this Doc View Source

    OnMessageSentAsync(IWolfClient, IWolfMessage, IWolfResponse, SerializedMessageData, CancellationToken)

    Handle message sent by the client, and the server's response.

    Declaration
    public virtual Task OnMessageSentAsync(IWolfClient client, IWolfMessage message, IWolfResponse response, SerializedMessageData rawResponse, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    IWolfClient client

    WOLF client that sent the message.

    IWolfMessage message

    Sent message.

    IWolfResponse response

    Response received.

    SerializedMessageData rawResponse

    Raw response data.

    System.Threading.CancellationToken cancellationToken

    Cancellation token that can be used for Task cancellation.

    Returns
    Type Description
    System.Threading.Tasks.Task

    Explicit Interface Implementations

    | Improve this Doc View Source

    IDisposable.Dispose()

    Declaration
    void IDisposable.Dispose()

    Implements

    IWolfClientCache
    IWolfClientCacheAccessor
    System.IDisposable