ExpressionCache
0.3.0-beta2
Lightweight, extensible caching for PowerShell.
Minimum PowerShell version
5.1
See the version list below for details.
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
## [0.3.0] - 2026-04-15
### Breaking Changes
- Redis provider: config key renamed from `Host` to `HostAddress` to match the `New-RedisClient` parameter name.
- Redis provider: default password changed from `'ChangeThisPassword!'` to `''` (empty). Set `$env:EXPRCACHE_REDIS_PASSWORD` or pass `Password` explicitly in config.
### Added
- **Thread safety**: `ReaderWriterLockSlim` for provider state, per-key `SemaphoreSlim` gates for single-flight cache operations.
- **PowerShell 5.1 compatibility**: replaced all `[type]::new()` calls with `New-Object`; added `Invoke-ParallelRunspace` helper for PS 5.1 concurrent tests.
- **Test coverage**: added test suites for `Get-ExpressionCacheProvider`, `Remove-ExpressionCacheProvider`, `Set-ProviderConfig`, `Set-ProviderStateValues`, `With-ProviderLock`, `ProviderStateAndConfig`, and `ConfigMerge` (7 new test files, 87 total tests).
- **Redis test infrastructure**: auto-detection of Redis via Docker or local `redis-cli`, isolated test prefix per run, skip logic for environments without Redis.
- Configurable `JsonDepth` with truncation warnings for deep object graphs.
### Fixed
- `Test-ExpressionCacheProviderSpec`: relaxed missing-command check from throw to warning, fixing cross-scope compatibility for custom providers defined outside the module.
- `Merge-ObjectDeep`: fixed `-or` to `-and` for map type check; array-wrapped `.Keys` to prevent enumeration bugs.
- `Get-FromLocalFileSystem`: added `-ErrorAction Stop` to `Get-Item` so TOCTOU race is caught by the existing `try/catch` (PS 5.1 non-terminating error fix).
- InMemoryCache sample: fixed module scope isolation — dot-source provider, use `global:` function prefix so ExpressionCache can invoke custom provider functions.
- Redis provider: removed duplicate `Get-RedisClient` function that shadowed the client initializer (caused by `Ensure-RedisClient` rename collision).
- Redis provider: fixed `Use-RedisClient` leaking the client object into the pipeline.
- Redis provider: suppressed unwanted output from lazy client initialization.
- `Initialize-ExpressionCache`: fixed output leaking to pipeline.
- Naming inconsistencies across module (standardized to PowerShell approved verbs where possible).
- Temp file cleanup in `LocalFileSystem` provider.
### Changed
- Redis provider documentation rewritten to accurately reflect capabilities (native RESP protocol, thread-safe init, sliding TTL, SCAN-based clearing, envelope serialization with gzip).
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\New-ExpressionCacheKey.ps1
- Public\Remove-ExpressionCacheProvider.ps1
- Public\Set-ProviderConfig.ps1
- Public\Set-ProviderStateValue.ps1
- Public\Set-ProviderStateValues.ps1
- Public\With-ProviderLock.ps1
- Utilities\Assert-MandatoryParamsPresent.ps1
- Utilities\Build-CallableSplat.ps1
- Utilities\Build-SplatFromConfig.ps1
- Utilities\Bump-ProviderStateMeta.ps1
- Utilities\ConvertTo-PSCustomObjectDeep.ps1
- Utilities\Copy-OrderedShallow.ps1
- Utilities\Ensure-ProviderState.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 |
|---|---|---|
| 0.3.1-beta2 | 3 | 4/16/2026 |
| 0.3.0-beta2 (current version) | 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 |