Skip to content

Commit

Permalink
Reapply overwritten changes (#22727)
Browse files Browse the repository at this point in the history
The changes to `TestSnapshotCache`
https://github.com/microsoft/FluidFramework/pull/22585/files
Got overwritten by refactoring it to `TestPersistedCache`:
https://github.com/microsoft/FluidFramework/pull/22698/files

Reapplying those older changes.
  • Loading branch information
tyler-cai-microsoft authored Oct 4, 2024
1 parent 2e945a4 commit 964e3ef
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/test/test-end-to-end-tests/src/testPersistedCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,19 @@ export interface ValueWithSnapshot {
}

export class TestPersistedCache implements IPersistedCache {
private readonly cache = new Map<string, ValueWithSnapshot>();
private readonly cache = new Map<string, unknown>();
private readonly versionCache = new Map<string, ValueWithSnapshot>();
private readonly versionToCacheKey = new Map<string, string>();
public async get(entry: ICacheEntry): Promise<ValueWithSnapshot | undefined> {
public async get(entry: ICacheEntry): Promise<any | undefined> {
const key = getKeyForCacheEntry(entry);
return this.cache.get(key);
}
public async put(entry: ICacheEntry, value: ValueWithSnapshot): Promise<void> {
public async put(entry: ICacheEntry, value: any): Promise<void> {
const key = getKeyForCacheEntry(entry);
this.cache.set(key, value);
if (value.value?.snapshotTree?.id === undefined) {
return;
}
const versionKey = `${value.value.snapshotTree.id}`;
this.versionCache.set(versionKey, value);
this.versionToCacheKey.set(versionKey, key);
Expand Down

0 comments on commit 964e3ef

Please sign in to comment.