Skip to content

Commit b831790

Browse files
Fix absolute expire
1 parent 6ab2ac7 commit b831790

File tree

1 file changed

+1
-5
lines changed
  • packages/utils/src/lib/server/cache

1 file changed

+1
-5
lines changed

packages/utils/src/lib/server/cache/s3.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ export class S3Cache<V extends Uint8Array = Uint8Array> extends BaseCache<V> {
4848
return `${this.#options.keyPrefix ?? ''}${key}`;
4949
}
5050

51-
private async isExpired(entry: CacheEntry<V>): Promise<boolean> {
52-
return entry.expiresAt !== undefined && Date.now() > entry.expiresAt;
53-
}
54-
5551
public async get(key: string): Promise<V | undefined> {
5652
const s3Key = this.buildKey(key);
5753
const head = await this.#client.send(
@@ -87,7 +83,7 @@ export class S3Cache<V extends Uint8Array = Uint8Array> extends BaseCache<V> {
8783
let expiresAt: number | undefined;
8884
if (ttl !== undefined) {
8985
const jitterFn = createJitter(jitter ?? this.#options.defaultJitter ?? JitterMode.None);
90-
expiresAt = Math.round(jitterFn(ttl));
86+
expiresAt = Date.now() + Math.round(jitterFn(ttl));
9187
}
9288

9389
await this.#client.send(

0 commit comments

Comments
 (0)