Set-PSUCache -AbsoluteExpirationFromNow does not expire

I understand that the following cache variable should expire after 6 minutes.

Set-PSUCache -Key “SavedText1” -Value “Saved text 1” -AbsoluteExpirationFromNow ([TimeSpan]::FromMinutes(6))

However, it is still available 40 minutes later. I can retrieve the value from cache and can also see it on the portal.

Key Persistent Created Updated Last Read Expiration Sliding Expiration Absolute Expiration Relative To Now
SavedText1 No May 13, 2025 10:05 AM May 13, 2025 10:14 AM May 13, 2025 10:41 AM 00:06:00
Product: PowerShell Universal
Version: 5.5.2

It’s still there, 2 days later…

Hey @ivanl , Ive tried it here as well and can see the same behaviour in 5.4.1

I can see a number of issues with the expiration behaviour. Once I read a cached item it doesnt expire regardless of if its using absolute or sliding windows. seems like a bug

Ill log one i github for it now

1 Like

Logged here: Cached values dont observe expiration rules once the value is read · Issue #4798 · ironmansoftware/powershell-universal · GitHub