cacheCredentialsAndCleanUp method
Implementation
void cacheCredentialsAndCleanUp(int scopeId, SessionQCloudCredentials newCredentials) {
credentialPairs.removeWhere((key, value) => !value.isValid());
if (credentialPairs.length > MAX_CACHE_CREDENTIAL_SIZE) {
int overSize = credentialPairs.length - MAX_CACHE_CREDENTIAL_SIZE;
credentialPairs.removeWhere((key, value) {
if (overSize-- > 0) {
return true;
} else {
return false;
}
});
}
credentialPairs[scopeId] = newCredentials;
}