Search Results for

    Show / Hide Table of Contents
    View Source

    Class ServerRegistrationService

    Manages server registrations in the database.

    Inheritance
    System.Object
    RepositoryService
    Namespace: Umbraco.Cms.Core.Services.Implement
    Assembly: Umbraco.Core.dll
    Syntax
    public sealed class ServerRegistrationService : RepositoryService, IService, IServerRegistrationService

    Constructors

    View Source

    ServerRegistrationService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IServerRegistrationRepository, IHostingEnvironment)

    Initializes a new instance of the ServerRegistrationService class.

    Declaration
    public ServerRegistrationService(ICoreScopeProvider scopeProvider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IServerRegistrationRepository serverRegistrationRepository, IHostingEnvironment hostingEnvironment)
    Parameters
    Type Name Description
    ICoreScopeProvider scopeProvider
    ILoggerFactory loggerFactory
    IEventMessagesFactory eventMessagesFactory
    IServerRegistrationRepository serverRegistrationRepository
    IHostingEnvironment hostingEnvironment

    Methods

    View Source

    DeactiveServer(String)

    Deactivates a server.

    Declaration
    public void DeactiveServer(string serverIdentity)
    Parameters
    Type Name Description
    System.String serverIdentity

    The server unique identity.

    View Source

    DeactiveStaleServers(TimeSpan)

    Deactivates stale servers.

    Declaration
    public void DeactiveStaleServers(TimeSpan staleTimeout)
    Parameters
    Type Name Description
    TimeSpan staleTimeout

    The time after which a server is considered stale.

    View Source

    GetActiveServers(Boolean)

    Return all active servers.

    Declaration
    public IEnumerable<IServerRegistration>? GetActiveServers(bool refresh = false)
    Parameters
    Type Name Description
    System.Boolean refresh

    A value indicating whether to force-refresh the cache.

    Returns
    Type Description
    System.Nullable<IEnumerable<IServerRegistration>>

    All active servers.

    Remarks

    By default this method will rely on the repository's cache, which is updated each time the current server is touched, and the period depends on the configuration. Use the refresh parameter to force a cache refresh and reload active servers from the database.

    View Source

    GetCurrentServerRole()

    Gets the role of the current server.

    Declaration
    public ServerRole GetCurrentServerRole()
    Returns
    Type Description
    ServerRole

    The role of the current server.

    View Source

    GetServers(Boolean)

    Return all servers (active and inactive).

    Declaration
    public IEnumerable<IServerRegistration> GetServers(bool refresh = false)
    Parameters
    Type Name Description
    System.Boolean refresh

    A value indicating whether to force-refresh the cache.

    Returns
    Type Description
    IEnumerable<IServerRegistration>

    All servers.

    Remarks

    By default this method will rely on the repository's cache, which is updated each time the current server is touched, and the period depends on the configuration. Use the refresh parameter to force a cache refresh and reload all servers from the database.

    View Source

    TouchServer(String, TimeSpan)

    Touches a server to mark it as active; deactivate stale servers.

    Declaration
    public void TouchServer(string serverAddress, TimeSpan staleTimeout)
    Parameters
    Type Name Description
    System.String serverAddress

    The server URL.

    TimeSpan staleTimeout

    The time after which a server is considered stale.

    • Improve this Doc
    • View Source
    In This Article
    • Constructors
      • ServerRegistrationService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IServerRegistrationRepository, IHostingEnvironment)
    • Methods
      • DeactiveServer(String)
      • DeactiveStaleServers(TimeSpan)
      • GetActiveServers(Boolean)
      • GetCurrentServerRole()
      • GetServers(Boolean)
      • TouchServer(String, TimeSpan)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX