MethodsAndPractices / vsteam

PowerShell module for accessing Azure DevOps Services and Azure DevOps Server (formerly VSTS or TFS)
https://methodsandpractices.github.io/vsteam-docs/
MIT License
445 stars 155 forks source link

Improvements to Get-VsTeamProcess and ProcessCache & ProjectCache classes #300

Open jhoneill opened 4 years ago

jhoneill commented 4 years ago

It would be useful if Get-VSTeamProcess

  1. Got process information from the /work/processes URI path rather than process/processes as the former has additional details
  2. Could query from processes with a wildcard name.
  3. Updated the cached process information
  4. Displayed whether a process was disabled or was the default process.

It would be neater if the cache classes had an update method to

  1. call the _getWhatever mockable function and store the result
  2. Update the cache time (at some point it would also change how the the cache times out. Currently it will time out if the time goes from 15:27:59.99 to 15:28.00.01 but not if it goes to 17:27:30 )

and a getCurrent method to decided if the cache is stale, and call update if it is.

This means instead of having

If (_staleTest) {
  [class]::content = _getSomething
  [class]::timesamp = Something
}
doSomethingWith  [class]::content

We can simply use doSomethingWith [class]::GetCurrent(). The old ways still work, for things which need to update or invalidate the cache.

I have made these changes, and they will also come in my next PR, as with 299, I wanted an issue to link to.