Class PackageCacheManager
The manager a cache of packages with a maximum cache age.
Inheritance
Implements
Inherited Members
Namespace: Phoenix.PackageManagement
Assembly: Phoenix.Core.dll
Syntax
public class PackageCacheManager : IPackageCacheManager
Constructors
View SourcePackageCacheManager(IPhoenixLogger, ISettingsManager)
Initializes a new instance of the PackageCacheManager class.
Declaration
public PackageCacheManager(IPhoenixLogger logger, ISettingsManager settingsManager)
Parameters
Type | Name | Description |
---|---|---|
IPhoenixLogger | logger | The logger. |
ISettingsManager | settingsManager |
Fields
View SourceFallbackMaxAge
Gets the default maximum age for a device's packages.
Declaration
public static readonly TimeSpan FallbackMaxAge
Field Value
Type | Description |
---|---|
System.TimeSpan |
Methods
View SourceForceCacheRefresh(IDevice)
Forces the cache to reset for the device.
Declaration
public async Task ForceCacheRefresh(IDevice device)
Parameters
Type | Name | Description |
---|---|---|
IDevice | device | The target device. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task which performs the reset. |
GetMaxAge(IDevice)
Gets the internal max cache age for a device's packages.
Declaration
public TimeSpan GetMaxAge(IDevice device)
Parameters
Type | Name | Description |
---|---|---|
IDevice | device | The target device. |
Returns
Type | Description |
---|---|
System.TimeSpan | The max cache age. |
GetPackagesAsync(IDevice)
Gets the packages for a specific device, refreshing the cache if the packages are older than the internal max cache age.
Declaration
public async Task<IList<IPackage>> GetPackagesAsync(IDevice device)
Parameters
Type | Name | Description |
---|---|---|
IDevice | device | The target device. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IList<IPackage>> | The packages for that device. |
GetPackagesAsync(IDevice, PackageFilter)
Gets a filtered set of packages for a specific device, refreshing the cache if the packages are older than the internal max cache age.
Declaration
public async Task<IList<IPackage>> GetPackagesAsync(IDevice device, PackageFilter filter)
Parameters
Type | Name | Description |
---|---|---|
IDevice | device | The target device. |
PackageFilter | filter | The filter to apply. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IList<IPackage>> | The packages for that device. |
GetPackagesAsync(IDevice, PackageFilter, TimeSpan)
Gets a filtered set of packages for a specific device, refreshing the cache if the packages are older than the supplied max cache age.
Declaration
public async Task<IList<IPackage>> GetPackagesAsync(IDevice device, PackageFilter filter, TimeSpan maxCacheAge)
Parameters
Type | Name | Description |
---|---|---|
IDevice | device | The device to get the packages for. |
PackageFilter | filter | The filter to apply. |
System.TimeSpan | maxCacheAge | The maximum cache age. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IList<IPackage>> | The packages for that device. |
GetPackagesAsync(IDevice, TimeSpan)
Gets the packages for a specific device, refreshing the cache if the packages are older than the supplied max cache age.
Declaration
public async Task<IList<IPackage>> GetPackagesAsync(IDevice device, TimeSpan maxCacheAge)
Parameters
Type | Name | Description |
---|---|---|
IDevice | device | The device to get the packages for. |
System.TimeSpan | maxCacheAge | The maximum cache age. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IList<IPackage>> | The packages for that device. |
SetMaxAge(IDevice, TimeSpan)
Sets the max age for a device's packages.
Declaration
public void SetMaxAge(IDevice device, TimeSpan maxAge)
Parameters
Type | Name | Description |
---|---|---|
IDevice | device | The target device. |
System.TimeSpan | maxAge | The maximum age. |