Skip to content

Commit

Permalink
fix: fix unstable cache key
Browse files Browse the repository at this point in the history
  • Loading branch information
arianrhodsandlot committed Oct 21, 2023
1 parent 8fbec59 commit 25948dd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/core/classes/file-system-providers/dropbox-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class DropboxProvider implements FileSystemProvider {
}

async getContentAndCache(path: string) {
const cacheKey = { name: `${this.constructor.name}.peekContent`, path }
const cacheKey = { name: 'DropboxProvider.peekContent', path }
const blob = await this.getContent(path)

const text = await blob.text()
Expand All @@ -45,7 +45,7 @@ export class DropboxProvider implements FileSystemProvider {
}

async peekContent(path: string) {
const cacheKey = { name: `${this.constructor.name}.peekContent`, path }
const cacheKey = { name: 'DropboxProvider.peekContent', path }
const rawCache = await RequestCache.get(cacheKey)
return rawCache?.value
}
Expand Down Expand Up @@ -78,7 +78,7 @@ export class DropboxProvider implements FileSystemProvider {
} while (listNextPage)

if (children?.length) {
RequestCache.set({ name: `${this.constructor.name}.peek`, path }, children)
RequestCache.set({ name: 'DropboxProvider.peek', path }, children)
}

return children.map(
Expand All @@ -93,7 +93,7 @@ export class DropboxProvider implements FileSystemProvider {
}

async peek(path: string) {
const rawCache = await RequestCache.get({ name: `${this.constructor.name}.peek`, path })
const rawCache = await RequestCache.get({ name: 'DropboxProvider.peek', path })
const children = rawCache?.value
const fileAccessors: FileAccessor[] | undefined = children?.map(
(item) =>
Expand Down
10 changes: 5 additions & 5 deletions src/core/classes/file-system-providers/google-drive-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class GoogleDriveProvider implements FileSystemProvider {
}

async getContentAndCache(path: string) {
const cacheKey = { name: `${this.constructor.name}.peekContent`, path }
const cacheKey = { name: 'GoogleDriveProvider.peekContent', path }
const blob = await this.getContent(path)

const text = await blob.text()
Expand All @@ -61,7 +61,7 @@ export class GoogleDriveProvider implements FileSystemProvider {
}

async peekContent(path: string) {
const cacheKey = { name: `${this.constructor.name}.peekContent`, path }
const cacheKey = { name: 'GoogleDriveProvider.peekContent', path }
const rawCache = await RequestCache.get(cacheKey)
return rawCache?.value
}
Expand Down Expand Up @@ -110,7 +110,7 @@ export class GoogleDriveProvider implements FileSystemProvider {
} while (listNextPage)

if (children?.length) {
RequestCache.set({ name: `${this.constructor.name}.peek`, path }, children)
RequestCache.set({ name: 'GoogleDriveProvider.peek', path }, children)
}

return children.map(
Expand All @@ -126,7 +126,7 @@ export class GoogleDriveProvider implements FileSystemProvider {
}

async peek(path: string) {
const rawCache = await RequestCache.get({ name: `${this.constructor.name}.peek`, path })
const rawCache = await RequestCache.get({ name: 'GoogleDriveProvider.peek', path })
const children = rawCache?.value
const fileAccessors: FileAccessor[] | undefined = children?.map(
(item) =>
Expand Down Expand Up @@ -214,7 +214,7 @@ export class GoogleDriveProvider implements FileSystemProvider {
private async getDirectoryWithCache(path: string) {
const { cacheable } = await RequestCache.makeCacheable({
func: (path: string) => this.getDirectory(path),
identifier: `${this.constructor.name}.getDirectory`,
identifier: 'GoogleDriveProvider.getDirectory',
})
return cacheable(path)
}
Expand Down
8 changes: 4 additions & 4 deletions src/core/classes/file-system-providers/onedrive-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class OnedriveProvider implements FileSystemProvider {
}

async getContentAndCache(path: string) {
const cacheKey = { name: `${this.constructor.name}.peekContent`, path }
const cacheKey = { name: 'OnedriveProvider.peekContent', path }
const blob = await this.getContent(path)

const text = await blob.text()
Expand All @@ -46,7 +46,7 @@ export class OnedriveProvider implements FileSystemProvider {
}

async peekContent(path: string) {
const cacheKey = { name: `${this.constructor.name}.peekContent`, path }
const cacheKey = { name: 'OnedriveProvider.peekContent', path }
const rawCache = await RequestCache.get(cacheKey)
return rawCache?.value
}
Expand Down Expand Up @@ -80,7 +80,7 @@ export class OnedriveProvider implements FileSystemProvider {
} while (listNextPage)

if (children?.length) {
RequestCache.set({ name: `${this.constructor.name}.peek`, path }, children)
RequestCache.set({ name: 'OnedriveProvider.peek', path }, children)
}

return children.map(
Expand All @@ -95,7 +95,7 @@ export class OnedriveProvider implements FileSystemProvider {
}

async peek(path: string) {
const rawCache = await RequestCache.get({ name: `${this.constructor.name}.peek`, path })
const rawCache = await RequestCache.get({ name: 'OnedriveProvider.peek', path })
const children = rawCache?.value
const fileAccessors: FileAccessor[] | undefined = children?.map(
(item) =>
Expand Down

0 comments on commit 25948dd

Please sign in to comment.