ExpressionCache

1.0.0

Lightweight, extensible caching for PowerShell.

Minimum PowerShell version

5.1

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Module -Name ExpressionCache

Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info

Install-PSResource -Name ExpressionCache

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Owners

Copyright

© 2025-2026 Gary McNickle. MIT.

Package Details

Author(s)

  • Gary McNickle

Tags

caching powershell scriptblock

PSEditions

Desktop Core

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

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
Show more