From 75406c7cfc020b9661d647cf7e9ce16d07e6790c Mon Sep 17 00:00:00 2001 From: RelicOfTesla Date: Thu, 11 Dec 2025 16:13:46 +0800 Subject: [PATCH] WithExpirationDeadline --- cache.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cache.go b/cache.go index 6bd54ff..64cf20a 100644 --- a/cache.go +++ b/cache.go @@ -85,6 +85,13 @@ func WithExpiration(exp time.Duration) ItemOption { } } +// WithExpirationDeadline is an option to set expiration deadline for any items. +func WithExpirationDeadline(deadline time.Time) ItemOption { + return func(o *itemOptions) { + o.expiration = deadline + } +} + // WithReferenceCount is an option to set reference count for any items. // This option is only applicable to cache policies that have a reference count (e.g., Clock, LFU). // referenceCount specifies the reference count value to set for the cache item.