mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 09:16:38 -04:00
Cache clearing logic
This commit is contained in:
parent
93d969a3b0
commit
75d941bc93
1 changed files with 10 additions and 5 deletions
|
@ -68,10 +68,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
$: desiredRetentionWarning = getRetentionLongShortWarning(roundedRetention);
|
$: desiredRetentionWarning = getRetentionLongShortWarning(roundedRetention);
|
||||||
|
|
||||||
let desiredRetentionChangeInfo = "";
|
let desiredRetentionChangeInfo = "";
|
||||||
$: {
|
$: if (showDesiredRetentionTooltip) {
|
||||||
showDesiredRetentionTooltip
|
getRetentionChangeInfo(roundedRetention, fsrsParams($config));
|
||||||
? getRetentionChangeInfo(roundedRetention, fsrsParams($config))
|
|
||||||
: "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$: retentionWarningClass = getRetentionWarningClass(roundedRetention);
|
$: retentionWarningClass = getRetentionWarningClass(roundedRetention);
|
||||||
|
@ -106,17 +104,24 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
let retentionWorloadInfo: undefined | Promise<GetRetentionWorkloadResponse> =
|
let retentionWorloadInfo: undefined | Promise<GetRetentionWorkloadResponse> =
|
||||||
undefined;
|
undefined;
|
||||||
|
let lastParams = [...fsrsParams($config)];
|
||||||
|
|
||||||
async function getRetentionChangeInfo(retention: number, params: number[]) {
|
async function getRetentionChangeInfo(retention: number, params: number[]) {
|
||||||
if (+startingDesiredRetention == roundedRetention) {
|
if (+startingDesiredRetention == roundedRetention) {
|
||||||
desiredRetentionChangeInfo = tr.deckConfigWorkloadFactorUnchanged();
|
desiredRetentionChangeInfo = tr.deckConfigWorkloadFactorUnchanged();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!retentionWorloadInfo) {
|
if (
|
||||||
|
// If the cache is empty and a request has not yet been made to fill it
|
||||||
|
!retentionWorloadInfo ||
|
||||||
|
// If the parameters have been changed
|
||||||
|
lastParams.toString() !== fsrsParams($config).toString()
|
||||||
|
) {
|
||||||
const request = new GetRetentionWorkloadRequest({
|
const request = new GetRetentionWorkloadRequest({
|
||||||
w: params,
|
w: params,
|
||||||
search: defaultparamSearch,
|
search: defaultparamSearch,
|
||||||
});
|
});
|
||||||
|
lastParams = [...fsrsParams($config)];
|
||||||
retentionWorloadInfo = getRetentionWorkload(request);
|
retentionWorloadInfo = getRetentionWorkload(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue