Skip to main content

1E 23.11 (SaaS)

CacheCleaner

The downloaded content in the Nomad cache consume disk space, therefore management of the cache is critical. Because files may be re-used and distributed to other devices on the same subnet or site, the simple solution of deleting the files as soon as they have finished downloading and executing is not sufficient. Instead, Nomad has a cache cleaner utility that automatically but intelligently maintains control over the cache's disk usage.

Nomad cache is used in a number of deployment scenarios, for example scenarios and how you can monitor those deployments using the Nomad app refer to:

Cache clean cycle versus CacheCleaner
Cleaning the cache using the cache clean cycle

The automated cache clean cycle runs automatically on a regular configurable interval. Nomad was designed to cache content that Configuration Manager has requested or that has been pre-cached using Content Distribution. Because of this the content accumulated in the Nomad Cache can become quite extensive, with a large degree of it no longer relevant or useful. For example, a Windows software update which has been superseded by a newer update is no longer relevant or useful and can be safely removed. The cache clean cycle helps to manage the Nomad cache, remove aged and irrelevant content and minimize its impact on the host machine.

The cache clean cycle is turned off by default, so the registry entries must be set before it will start to regularly clean the cache.

Configuration options

This option is configured by setting the following registry values or installer properties:

Registry Value

Default Value

Installer Property

Description

CacheCleanCycleHrs

0 (turned off)

CACHECLEANCYCLEHRS

The first automatic cache clean runs randomly between 10 to 60 mins of service start up. Subsequent cache clean cycles run after the number of hours specified.

0 means feature turned off. No cache cleaning cycle would run. Changing this registry entry performs an internal restart.

The minimum value is 4.

The maximum value is 168 (Once a week)

CacheCleanSubnetLookup

1 (turned on)

CACHECLEANSUBNETLOOKUP

Before deleting content, Nomad checks if it is on any other client in the same subnet, and will only delete local content if the same is present on at least one other client on the same subnet.

To disable subnet lookup, set the value to 0. Its value can be 0 or 1.

The default value is 1, subnet lookup is enabled.

New setting introduced in 8.0.

MaxCacheDays

0 (turned off)

MAXCACHEDAYS

Set to delete application or package content that last triggered Nomad elections before the specified number of days from the date the cache cleaner runs.

This ensures that only application or package content that have triggered elections recently will be kept in the cache.

0 means that application and package content will not be deleted automatically when the cache cleaner runs.

MaxCacheDaysThreshold

0 (turned off)

MAXCACHEDAYSTHRESHOLD

This is the maximum number of days content is present on a client. If it's not zero, then content will be deleted without any other checks once it reaches the threshold. If the threshold has a value greater than zero and less than 30, Nomad uses the threshold of 30 days and creates an associated log.

Default value is 0.

New setting introduced in 8.0.

MaxPreCacheDays

0 (turned off)

MAXPRECACHEDAYS

Set to delete pre-cached content that last triggered Nomad elections before the specified number of days from the date the cache cleaner runs.

This ensures that only pre-cached content that has triggered elections recently will be kept in the cache.

0 means that pre-cached content will not be deleted automatically when the cache cleaner runs.

MaxSUCacheDays

0 (turned off)

MAXSUCACHEDAYS

Set to delete software updates that last triggered Nomad elections before the specified number of days from the date the cache cleaner runs.

This ensures that only software updates that have triggered elections recently will be kept in the cache.

0 means that software updates will not be deleted automatically when the cache cleaner runs.

DpCacheCleanupEnabled

0 (turned off)

DPCACHECLEANUPENABLED

Deletes all LSZ files in a Distribution Point (DP) cache whose content is no longer distributed, that is not present in ContentLib.

To enable DP Cache Cleaner, set the value of registry to 1 (any value except for 0 enables this feature).

Cache clean cycle delete conditions

When the cache clean cycle runs, it will check the type of each content and the last election date associated with it. There are four main types of content, and these will be marked for deletion if the following delete conditions are true:

Content type

Delete condition

Pre-cached

last election date + MaxPreCacheDays > cache clean cycle run date

Application or package

last election date + MaxCacheDays > cache clean cycle run date

Office 365 update byte-range

last election date + MaxSUCacheDays > cache clean cycle run date

Software updates related to SMSTSNomad jobs

The cache clean cycle will then also check the following, for all content other than Office 365 update byte-ranges:

  1. The content should be present on at least one of the Nomad subnet peers with an equal or a higher percentage of content

  2. The network has broadcasts enabled

If both of these conditions are also true, the content will be deleted.

Caveats

The following points describe various caveats related to the way that the cache clean cycle works:

  • If pre-cache content is deleted by the cache clean cycle, but the corresponding pre-caching job still exists, Content Distribution will send the download notification again to the client

    Note

    If your Nomad policy is to not delete pre-caching jobs, you should turn off deletion of pre-cached content by setting the MaxPreCacheDays registry value to 0.

  • Application upgrades and uninstallation via Software Center require content to be present on the machines (the current version is required for uninstallation and the previous version is required for upgrade scenarios). If the content has been deleted by the cache clean cycle, the content would be downloaded again at uninstall or upgrade time. Because of the way that the cache clean cycle delete conditions are applied Nomad retains one copy of the content per subnet, so even if such a download request comes the content would be downloaded from a Nomad peer and not a DP

  • ByteRange content is not checked to be present on subnet peers

  • Cache optimization does not work for content that is to be activated later on

  • Cache optimization does work on Sensitive Servers.

Cleaning the cache using CacheCleaner

To maintain the cache Nomad uses a set of basic rules that lets you decide the cache's effect on overall disk usage and performs automatic cleaning when necessary. When a job is advertised, automatic cache cleaning could occur under the following circumstances:

  • If the percentage of available disk space is less than the PercentAvailableDisk setting after downloading an incoming package, according to its download package size, automatic cache cleaning is initiated before the download takes place

  • Nomad then assesses how much space could be cleared by deleting cache folders that are eligible for deletion. A cache folder is deemed eligible for deletion if its cache priority value is lower than or equal to the cache priority value of the incoming package. The cache priority value is set on the Nomad command-line using the pc argument, or set in the Nomad properties page when using Configuration Manager. By default, if no value is specified, packages have a cache priority of 1

  • If the assessment determines there would still not be sufficient space available: no deletion will take place, the download is aborted and an error logged, which may be one of:

    • Insufficient disk or cache space available to download the Program…

    • Insufficient cache space available to achieve a Max Cache Size of X

  • If the assessment determines there would be sufficient space available in the cache: the folders are deleted in order according to their cache priority until the required disk space is available.

Cache cleaner and Configuration Manager

When Nomad is used with Configuration Manager the cache cleaner will also:

  • Purge linked contents from the Configuration Manager cache

  • Purge older versions from the Configuration Manager cache before downloading the content for a newer version.

The cache cleaner mechanism also works with the priority job control to ensure that suspended lower priority job caches are not cleaned to make way for the higher priority job unless absolutely necessary.

Command-line switches

CacheCleaner is an executable that can be used to explicitly purge the Nomad cache. By default, the Nomad cache is not purged unless there is an active download. In most cases, available disk space is not really an issue, but there may be circumstances where you may want to manage the cache to keep the disk usage overhead to a minimum. Please refer to Cache management for further information about managing the cache.

It is installed as part of Nomad and the format of the command-line is:

CacheCleaner.exe -switch

Where switch is one of the following (case sensitive):

Switch name

Default value

Range

Description

-CachePriority

1

1-9

Only cache contents with a priority equal to or lower than the CachePriority are purged. Used in conjunction with Pkgsizeto emulate the behavior of the cache cleaner when an actual package is being downloaded.

-Debug

Sets the debug level for CacheCleaner and it can be passed on the command-line. If it is not, the value from Nomad registry is used. If Debug is already defined, using this argument adds to the logging level.

-Deleteall

Deletes all cache content where the priority is less than or equal to the value for Force. If the command-line does not include Force, then Deleteall deletes all cache content where the priority is 1. Works in conjunction with the Force .

-DeletePkg

The ID of the package or content to be deleted from the cache. The value must be set to the PackageID or ContentID string that identifies the content to be deleted. Must be used in conjunction with PkgVer .

-DeletePkg=PRI0000A -PkgVer=*
-DeletePkg=Content_9b9ccd56-9fbf-4587-98e7-725fcfa8e70f -PkgVer=*

-Force

Content whose cache priority is less than or equal to the CachePriority value are purged. Used in conjunction with the Deleteall and MaxCacheAge.

-MaxCacheAge

1-1461

The maximum number of days before the contents of a cache is purged. If set, CacheCleaner deletes cache contents which are older than this value.

This argument is ignored if DeletePkg and Deleteall is used on the command-line.

If the command-line includes Force , all caches with a priority less than or equal to CachePriority will have their content purged. If CachePriority is not included on the command-line, all caches with a priority=1 will have their content purged.

-PercentAvailableDisk

10

1-99

Deletes the lowest cache priority content until the set percentage of available disk is available.

-Pkgsize

Only caches with a priority equal to or lower than the CachePriority value will have their contents purged. Used in conjunction with CachePriority to emulate the behavior of the cache cleaner when an actual package is being downloaded.

Determine the space to be cleared when running cachecleaner.exe with PercentAvailableDisk . The PkgSize value is by default specified in bytes but can be set to MB by appending MB to the value.

For example, the following are equivalent:

-Pkgsize=1048576
-Pkgsize=1MB

-PkgVer

Identifies the content version to be deleted and must be used in conjunction with DeletePkg . Deletes content from both the Nomad and Configuration Manager client caches that corresponds to the version number and the Package ID (or Content ID).

The special value -PkgVer=* may be used when the user is unsure of the specific version of the package in the cache.

Note

Setting -PkgVer=* will delete any version of the content with the ID specified in the DeletePkg argument from the Nomad cache only – it will not delete from the Configuration Manager client cache.

Note

If you want to remove Application or Software Updates content, then the -PkgVer will usually need to be set to "1".

Note

If the Nomad cache is deleted while another client is accessing it, the other client will recover by downloading directly from the DP. This is by design and ensures recovery occurs in order to complete a successful download.

CacheCleaner examples

In the following examples, there is no requirement to specify the path to CacheCleaner.exe because the path to Nomad executables is set in the PATH environment variable:

Example

Description

Set the cache cleaner to run as a Configuration Manager program.

You can set the cache cleaner to run as a Configuration Manager program and advertise it to all Nomad systems in a single operation. You can also schedule this as a regular housekeeping job, ensuring that the cache is kept under control automatically.

To purge the cache when the total free disk space is at 20% run:

CacheCleaner.exe –PercentAvailableDisk=20

Ensure that content in the cache is not kept for more than 30 day.

To ensure that content in the cache is not kept for more than 30 days, run:

CacheCleaner.exe –MaxCacheAge=30

Delete a particular package and version.

To delete a particular package and version, run:

CacheCleaner.exe –DeletePkg=L0A00001 –PkgVer=1

Purge the contents of a cache with a priority of 3 or lower.

To purge the contents of a cache with a priority of 3 or lower, run:

CacheCleaner.exe –DeleteAll -Force=3

Purge the contents of a cache with a particular priority and size.

To purge the contents of a cache with a particular priority and size, run:

CacheCleaner.exe –PkgSize=10485760 –CachePriority=6