|
| 1 | +# Enable Framework Code Caching |
| 2 | + |
| 3 | +On certain systems with fewer CPU cores, there might be an impact while running Icinga for Windows because of long loading times for the Icinga PowerShell Framework. To mitigate this issue, we added the possibility to create a code cache file for the entire Icinga PowerShell Framework. |
| 4 | + |
| 5 | +What it does is to load every single module and content file into one single `cache.psm1` file which is loaded in case the caching is enabled. |
| 6 | + |
| 7 | +## Pre-Cautions |
| 8 | + |
| 9 | +By enabling this feature, you will have to generate a new cache file whenever you apply changes to any code for the Icinga PowerShell Framework. This can be done by running the Cmdlet |
| 10 | + |
| 11 | +```powershell |
| 12 | +Write-IcingaFrameworkCodeCache |
| 13 | +``` |
| 14 | + |
| 15 | +Please note that the code cache feature must be enabled first. |
| 16 | + |
| 17 | +In case you upgrade to a newer version of the Icinga PowerShell Framework, you will only require to manually proceed in case the code cache feature was disabled beforehand. In case the code cache feature is enabled during the upgrade, the cache file will be generated and updated automatically. |
| 18 | + |
| 19 | +## Enable Icinga Framework Code Cache |
| 20 | + |
| 21 | +To enable the Icinga PowerShell Framework code cache, simply run the following command within an Icinga Shell: |
| 22 | + |
| 23 | +```powershell |
| 24 | +Enable-IcingaFrameworkCodeCache |
| 25 | +``` |
| 26 | + |
| 27 | +Once activated, you should make sure to generate a new cache file before using the Framework: |
| 28 | + |
| 29 | +```powershell |
| 30 | +Write-IcingaFrameworkCodeCache |
| 31 | +``` |
| 32 | + |
| 33 | +If you leave the code caching feature enabled, future updates of the Framework will automatically generate a new cache file. If you disabled the feature in-between, please write the cache file manually. |
| 34 | + |
| 35 | +In case no cache file is present while the feature is activated, a cache file is generated on the first use of `Use-Icinga` or `icinga`. |
| 36 | + |
| 37 | +## Disable Icinga Framework Code Cache |
| 38 | + |
| 39 | +To disable the code caching feature again, you can simply run |
| 40 | + |
| 41 | +```powershell |
| 42 | +Disable-IcingaFrameworkCodeCache |
| 43 | +``` |
| 44 | + |
| 45 | +Please note that even though the cache file is no longer loaded it still remains. Therefor you will have to manually use `Write-IcingaFrameworkCodeCache` in case you activate the feature later again. This is especially required if you update the Icinga PowerShell Framework while the feature was disabled. |
0 commit comments