ExpressionCache
1.0.0
Lightweight, extensible caching for PowerShell.
Minimum PowerShell version
5.1
Installation Options
Owners
Copyright
© 2025-2026 Gary McNickle. MIT.
Package Details
Author(s)
- Gary McNickle
Tags
caching powershell scriptblock
PSEditions
Dependencies
This module has no dependencies.
Release Notes
## [1.0.0] - 2026-06-11
### Added
- Cross-process single-flight coordination for `LocalFileSystemCache`, preventing duplicate computation when multiple processes miss the same key concurrently.
- Distributed per-key locking for Redis cache misses.
- Optional Redis provider settings:
- `WaitSeconds` controls how long a caller waits for another worker computing the same key.
- `LockSeconds` controls the distributed lock lifetime for long-running computations.
- Redis concurrency tests covering lock acquisition, token-safe release, and client lease synchronization.
### Changed
- Prepared the public contract for 1.0:
- Provider hooks are command-name strings with canonical `Initialize`, `GetOrCreate`, `ClearCache`, and `Teardown` properties.
- `GetOrCreate` commands must declare `Key` and `ScriptBlock`; `ProviderName`, `Arguments`, `Policy`, and `CacheVersion` are standard optional inputs.
- `With-ProviderLock` was renamed to `Invoke-ProviderLockedOperation`.
- `ProviderName` is the canonical parameter name, with `Name` retained as an alias.
- Missing provider lookups now use the PowerShell error stream and support common `-ErrorAction` behavior.
- Module exports are explicitly listed in the manifest.
- The automatic cache-key algorithm is treated as stable throughout the 1.x release line.
- Redis access using a shared provider client is synchronized for connection safety.
- Provider state reads and writes now participate consistently in provider locking.
- Local filesystem cache replacement is atomic during concurrent writes.
- The default Redis namespace changes from `v0` to `v1` when the module version advances to 1.0.
### Fixed
- Concurrent cache misses across runspaces or processes could execute the same expression more than once.
- Redis distributed locks now use the intended namespaced cache key instead of an empty key.
- Provider lock operations no longer shadow a caller's `$ScriptBlock` variable.
- Automatic cache keys now use OS-independent argument serialization.
- Internal provider lookup now works consistently under Windows PowerShell 5.1.
- Local filesystem cache writes could briefly remove the destination before replacing it.
FileList
- ExpressionCache.nuspec
- ExpressionCache.psd1
- ExpressionCache.psm1
- Providers\LocalFileSystem.ps1
- Providers\RedisCache.ps1
- Public\Add-ExpressionCacheProvider.ps1
- Public\Clear-ExpressionCache.ps1
- Public\Get-ExpressionCache.ps1
- Public\Get-ExpressionCacheProvider.ps1
- Public\Get-ProviderConfig.ps1
- Public\Get-ProviderStateValue.ps1
- Public\Initialize-ExpressionCache.ps1
- Public\Invoke-ProviderLockedOperation.ps1
- Public\New-ExpressionCacheKey.ps1
- Public\Remove-ExpressionCacheProvider.ps1
- Public\Set-ProviderConfig.ps1
- Public\Set-ProviderStateValue.ps1
- Public\Set-ProviderStateValues.ps1
- Utilities\Assert-MandatoryParamsPresent.ps1
- Utilities\Bump-ProviderStateMeta.ps1
- Utilities\ConvertTo-PSCustomObjectDeep.ps1
- Utilities\Copy-OrderedShallow.ps1
- Utilities\Ensure-ProviderState.ps1
- Utilities\Find-ExpressionCacheProvider.ps1
- Utilities\Get-DefaultProviders.ps1
- Utilities\Get-ExpressionCacheHash.ps1
- Utilities\Get-ProviderLock.ps1
- Utilities\Get-ProviderSpecificParamNames.ps1
- Utilities\Initialize-ProviderState.ps1
- Utilities\Invoke-ExpressionCacheProviderHook.ps1
- Utilities\Merge-ExpressionCacheConfig.ps1
- Utilities\Merge-ExpressionProviders.ps1
- Utilities\Merge-ObjectDeep.ps1
- Utilities\New-CallableSplat.ps1
- Utilities\New-DirectoryIfMissing.ps1
- Utilities\New-SplatFromConfig.ps1
- Utilities\Resolve-CachePolicy.ps1
- Utilities\Resolve-Providers.ps1
- Utilities\Set-ProviderState.ps1
- Utilities\Test-ExpressionCacheProviderSpec.ps1
- Utilities\Update-ProviderStateMeta.ps1
- Utilities\ValidateExpressionCacheProviders.ps1
Version History
| Version | Downloads | Last updated |
|---|---|---|
| 1.0.0 (current version) | 6 | 6/11/2026 |
| 0.3.1-beta2 | 3 | 4/16/2026 |
| 0.3.0-beta2 | 2 | 4/16/2026 |
| 0.3.0-beta1 | 2 | 4/16/2026 |
| 0.2.0-beta1 | 7 | 8/22/2025 |
| 0.1.2-beta1 | 6 | 8/20/2025 |
| 0.1.1-beta1 | 5 | 8/19/2025 |
| 0.1.0-beta1 | 4 | 8/19/2025 |