diff --git a/src/ipfs.ts b/src/ipfs.ts index 0814172..ff3197f 100644 --- a/src/ipfs.ts +++ b/src/ipfs.ts @@ -296,3 +296,24 @@ export class PinataStorageWithCache implements IPFS { } } } + +class NoOpCache implements ObjectCache { + getAndCache( + _cacheKey: string, + generator: (existing: T | undefined) => Promise, + _staleAfterSeconds?: number | undefined, + _returnStaleResult?: boolean | undefined, + _isBinary?: boolean | undefined, + ): Promise { + return generator(undefined) + } + put(_cacheKey: string, _data: T): Promise { + return Promise.resolve() + } +} + +export class PinataStorage extends PinataStorageWithCache { + constructor(pinataToken: string) { + super(pinataToken, new NoOpCache()) + } +}