Skip to content

Commit

Permalink
fix: Deprecate SimpleCache.set and recommend SimpleCache.getOrSet as …
Browse files Browse the repository at this point in the history
…the alternative
  • Loading branch information
JakeChampion committed Jul 12, 2023
1 parent 671bcea commit bff1bf5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions types/fastly:cache.d.ts
Expand Up @@ -10,7 +10,13 @@ declare module "fastly:cache" {

export class SimpleCache {
static get(key: string): SimpleCacheEntry | null;
/**
* @deprecated Use `SimpleCache.getOrSet` instead.
*/
static set(key: string, value: BodyInit, ttl: number): undefined;
/**
* @deprecated Use `SimpleCache.getOrSet` instead.
*/
static set(key: string, value: ReadableStream, ttl: number, length: number): undefined;
static getOrSet(key: string, set: () => Promise<{value: BodyInit, ttl: number}>): Promise<SimpleCacheEntry>;
static getOrSet(key: string, set: () => Promise<{value: ReadableStream, ttl: number, length: number}>): Promise<SimpleCacheEntry>;
Expand Down

0 comments on commit bff1bf5

Please sign in to comment.