|
|
|
|
@ -95,8 +95,8 @@ export class StateService<
@@ -95,8 +95,8 @@ export class StateService<
|
|
|
|
|
private hasBeenInited = false; |
|
|
|
|
private isRecoveredSession = false; |
|
|
|
|
|
|
|
|
|
protected accountDiskCacheSubject = new BehaviorSubject<Record<string, TAccount>>({}); |
|
|
|
|
accountDiskCache$ = this.accountDiskCacheSubject.asObservable(); |
|
|
|
|
// eslint-disable-next-line rxjs/no-exposed-subjects
|
|
|
|
|
accountDiskCache = new BehaviorSubject<Record<string, TAccount>>({}); |
|
|
|
|
|
|
|
|
|
// default account serializer, must be overridden by child class
|
|
|
|
|
protected accountDeserializer = Account.fromJSON as (json: Jsonify<TAccount>) => TAccount; |
|
|
|
|
@ -2769,7 +2769,7 @@ export class StateService<
@@ -2769,7 +2769,7 @@ export class StateService<
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (this.useAccountCache) { |
|
|
|
|
const cachedAccount = this.accountDiskCacheSubject.value[options.userId]; |
|
|
|
|
const cachedAccount = this.accountDiskCache.value[options.userId]; |
|
|
|
|
if (cachedAccount != null) { |
|
|
|
|
return cachedAccount; |
|
|
|
|
} |
|
|
|
|
@ -3165,15 +3165,15 @@ export class StateService<
@@ -3165,15 +3165,15 @@ export class StateService<
|
|
|
|
|
|
|
|
|
|
private setDiskCache(key: string, value: TAccount, options?: StorageOptions) { |
|
|
|
|
if (this.useAccountCache) { |
|
|
|
|
this.accountDiskCacheSubject.value[key] = value; |
|
|
|
|
this.accountDiskCacheSubject.next(this.accountDiskCacheSubject.value); |
|
|
|
|
this.accountDiskCache.value[key] = value; |
|
|
|
|
this.accountDiskCache.next(this.accountDiskCache.value); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private deleteDiskCache(key: string) { |
|
|
|
|
if (this.useAccountCache) { |
|
|
|
|
delete this.accountDiskCacheSubject.value[key]; |
|
|
|
|
this.accountDiskCacheSubject.next(this.accountDiskCacheSubject.value); |
|
|
|
|
delete this.accountDiskCache.value[key]; |
|
|
|
|
this.accountDiskCache.next(this.accountDiskCache.value); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|