Class ServerRegistrationService
Manages server registrations in the database.
Namespace: Umbraco.Cms.Core.Services.Implement
Assembly: cs.temp.dll.dll
Syntax
public sealed class ServerRegistrationService : RepositoryService
Constructors
ServerRegistrationService(IScopeProvider, ILoggerFactory, IEventMessagesFactory, IServerRegistrationRepository, IHostingEnvironment)
Initializes a new instance of the Server
Declaration
public ServerRegistrationService(IScopeProvider scopeProvider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IServerRegistrationRepository serverRegistrationRepository, IHostingEnvironment hostingEnvironment)
Parameters
Type | Name | Description |
---|---|---|
IScope |
scopeProvider | |
ILogger |
loggerFactory | |
IEvent |
eventMessagesFactory | |
IServer |
serverRegistrationRepository | |
IHosting |
hostingEnvironment |
Methods
DeactiveServer(String)
Deactivates a server.
Declaration
public void DeactiveServer(string serverIdentity)
Parameters
Type | Name | Description |
---|---|---|
System. |
serverIdentity | The server unique identity. |
DeactiveStaleServers(TimeSpan)
Deactivates stale servers.
Declaration
public void DeactiveStaleServers(TimeSpan staleTimeout)
Parameters
Type | Name | Description |
---|---|---|
System. |
staleTimeout | The time after which a server is considered stale. |
GetActiveServers(Boolean)
Return all active servers.
Declaration
public IEnumerable<IServerRegistration> GetActiveServers(bool refresh = false)
Parameters
Type | Name | Description |
---|---|---|
System. |
refresh | A value indicating whether to force-refresh the cache. |
Returns
Type | Description |
---|---|
System. |
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.
GetCurrentServerRole()
Gets the role of the current server.
Declaration
public ServerRole GetCurrentServerRole()
Returns
Type | Description |
---|---|
Server |
The role of the current server. |
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. |
serverAddress | The server URL. |
System. |
staleTimeout | The time after which a server is considered stale. |