refactor: rename persistence methods from persist/restore to save/load

This commit is contained in:
Danish Arora 2025-11-20 16:13:44 -05:00
parent 032c3f5faf
commit b8ee363cb1
No known key found for this signature in database
GPG Key ID: 1C6EF37CDAE1426E

View File

@ -47,7 +47,7 @@ export class PersistentHistory implements ILocalHistory {
this.memory = new MemLocalHistory();
this.storage = options.storage ?? getDefaultHistoryStorage();
this.storageKey = `${HISTORY_STORAGE_PREFIX}${options.storageKeyPrefix}:${options.channelId}`;
this.restore();
this.load();
}
public get length(): number {
@ -56,7 +56,7 @@ export class PersistentHistory implements ILocalHistory {
public push(...items: ContentMessage[]): number {
const length = this.memory.push(...items);
this.persist();
this.save();
return length;
}
@ -97,7 +97,7 @@ export class PersistentHistory implements ILocalHistory {
return this.memory.findIndex(predicate, thisArg);
}
private persist(): void {
private save(): void {
if (!this.storage) {
return;
}
@ -111,7 +111,7 @@ export class PersistentHistory implements ILocalHistory {
}
}
private restore(): void {
private load(): void {
if (!this.storage) {
return;
}