mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -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);
|
||||
|
||||
let desiredRetentionChangeInfo = "";
|
||||
$: {
|
||||
showDesiredRetentionTooltip
|
||||
? getRetentionChangeInfo(roundedRetention, fsrsParams($config))
|
||||
: "";
|
||||
$: if (showDesiredRetentionTooltip) {
|
||||
getRetentionChangeInfo(roundedRetention, fsrsParams($config));
|
||||
}
|
||||
|
||||
$: 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> =
|
||||
undefined;
|
||||
let lastParams = [...fsrsParams($config)];
|
||||
|
||||
async function getRetentionChangeInfo(retention: number, params: number[]) {
|
||||
if (+startingDesiredRetention == roundedRetention) {
|
||||
desiredRetentionChangeInfo = tr.deckConfigWorkloadFactorUnchanged();
|
||||
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({
|
||||
w: params,
|
||||
search: defaultparamSearch,
|
||||
});
|
||||
lastParams = [...fsrsParams($config)];
|
||||
retentionWorloadInfo = getRetentionWorkload(request);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue