-
-
Notifications
You must be signed in to change notification settings - Fork 1
Several improvements #214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Several improvements #214
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3fe07a1
fix(resetProjectDatabaseCache): correct function call to Reset-Database
rulasg 37327d6
refactor(ProjectDatabase): enhance caching mechanism and improve debu…
rulasg 2e29638
fit(Get-ValidNames): add "" as valid value to allow empy parameters
rulasg 59ac475
feat(Get-ProjectFields): add Exact parameter for precise field name f…
rulasg f7b8c18
fix(Use-Order): change return statement to Write-Output for consistency
rulasg 4f436a4
fix(Edit-ProjectItem): replace warning message with debug output for …
rulasg 122525e
Merge branch 'main' into rulasg/issue206
rulasg c73dc96
fix(Use-Order): remove unused ShowProjectItemScriptBlock logic
rulasg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| $script:ProjectDatabaseCache = @{} | ||
|
|
||
| function getProjectDatabaseCache{ | ||
| param( | ||
| [Parameter(Mandatory,Position = 0)][string]$KeyLock | ||
| ) | ||
|
|
||
| $lock = Get-Database -Key $KeyLock | ||
|
|
||
| if([string]::IsNullOrWhiteSpace($lock)){ | ||
| "No cache lock found for $KeyLock. Cache will be ignored." | Write-MyDebug -Section "ProjectDatabaseCache" | ||
| return $null | ||
| } | ||
|
|
||
| $cache = $script:ProjectDatabaseCache[$KeyLock] | ||
|
|
||
| if($lock -cne $cache.safeId) { | ||
| "Cache lock mismatch for $KeyLock. Cache safeId [$($cache.SafeId)], lock [$lock]. Cache will be ignored." | Write-MyDebug -Section "ProjectDatabaseCache" | ||
| resetProjectDatabaseCache -KeyLock $KeyLock | ||
| return $null | ||
| } | ||
|
|
||
| "Getting fields cache for $KeyLock with lock [$lock] and cache safeId [$($cache.SafeId)]" | Write-MyDebug -Section "ProjectDatabaseCache" | ||
| return $cache.Database | ||
| } | ||
|
|
||
| function setProjectDatabaseCache{ | ||
| param( | ||
| [Parameter(Mandatory,Position = 0)][string]$KeyLock, | ||
| [Parameter(Mandatory,Position = 1)][string]$SafeId, | ||
| [Parameter(Mandatory,Position = 2)][object]$Database | ||
| ) | ||
|
|
||
| "Setting project cache for $KeyLock with safeId [$SafeId]" | Write-MyDebug -Section "ProjectDatabaseCache" | ||
|
|
||
| # Save safeId to project-lock | ||
| Save-Database -Database $SafeId -Key $KeyLock | ||
|
|
||
| # Set lock in database to prevent concurrent updates | ||
| $script:ProjectDatabaseCache[$KeyLock] = @{ | ||
| Database = $Database | ||
| SafeId = $SafeId | ||
| } | ||
| } | ||
|
|
||
| function resetProjectDatabaseCache{ | ||
| param( | ||
| [Parameter(Mandatory,Position = 0)][string]$KeyLock | ||
| ) | ||
|
|
||
| "Resetting project cache for $KeyLock" | Write-MyDebug -Section "ProjectDatabase" | ||
|
|
||
| Reset-Database -Key $KeyLock | ||
|
|
||
| $script:ProjectDatabaseCache.Remove($KeyLock) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note