Purge cache
This commit is contained in:
parent
4f582c3279
commit
f22e784ee1
3 changed files with 12 additions and 2 deletions
|
|
@ -152,7 +152,8 @@ export class SyncClient {
|
|||
settings,
|
||||
syncService,
|
||||
fileOperations,
|
||||
unrestrictedSyncer
|
||||
unrestrictedSyncer,
|
||||
contentCache
|
||||
);
|
||||
|
||||
const webSocketManager = new WebSocketManager(
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import { createPromise } from "../utils/create-promise";
|
|||
import { SyncResetError } from "../services/sync-reset-error";
|
||||
import { Locks } from "../utils/locks";
|
||||
import type { DocumentVersionWithoutContent } from "../services/types/DocumentVersionWithoutContent";
|
||||
import type { FixedSizeDocumentCache } from "../utils/fix-sized-cache";
|
||||
|
||||
export class Syncer {
|
||||
private readonly remoteDocumentsLock: Locks<DocumentId>;
|
||||
|
|
@ -33,7 +34,8 @@ export class Syncer {
|
|||
settings: Settings,
|
||||
private readonly syncService: SyncService,
|
||||
private readonly operations: FileOperations,
|
||||
private readonly internalSyncer: UnrestrictedSyncer
|
||||
private readonly internalSyncer: UnrestrictedSyncer,
|
||||
private readonly contentCache: FixedSizeDocumentCache
|
||||
) {
|
||||
this.syncQueue = new PQueue({
|
||||
concurrency: settings.getSettings().syncConcurrency
|
||||
|
|
@ -250,6 +252,7 @@ export class Syncer {
|
|||
|
||||
public async reset(): Promise<void> {
|
||||
await this.waitUntilFinished();
|
||||
this.contentCache.clear();
|
||||
}
|
||||
|
||||
public async syncRemotelyUpdatedFile(
|
||||
|
|
|
|||
|
|
@ -54,4 +54,10 @@ export class FixedSizeDocumentCache {
|
|||
this.currentSizeInBytes -= lruEntry.byteLength;
|
||||
}
|
||||
}
|
||||
|
||||
public clear(): void {
|
||||
this.cache.clear();
|
||||
this.usageOrder = [];
|
||||
this.currentSizeInBytes = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue