mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
refs #781, use admit in database reader
* added amit functions in readers * cacheHasChanged functions (needed because data of caches are loaded in background) * pinned small caches * CDatabaseReader::readInBackgroundThread uses admitCaches now
This commit is contained in:
@@ -217,17 +217,17 @@ namespace BlackCore
|
||||
|
||||
void CModelDataReader::ps_liveryCacheChanged()
|
||||
{
|
||||
// void
|
||||
this->cacheHasChanged(CEntityFlags::LiveryEntity);
|
||||
}
|
||||
|
||||
void CModelDataReader::ps_modelCacheChanged()
|
||||
{
|
||||
// void
|
||||
this->cacheHasChanged(CEntityFlags::ModelEntity);
|
||||
}
|
||||
|
||||
void CModelDataReader::ps_distributorCacheChanged()
|
||||
{
|
||||
// void
|
||||
this->cacheHasChanged(CEntityFlags::DistributorEntity);
|
||||
}
|
||||
|
||||
void CModelDataReader::ps_baseUrlCacheChanged()
|
||||
@@ -387,7 +387,7 @@ namespace BlackCore
|
||||
{
|
||||
CLiveryList liveries;
|
||||
liveries.convertFromJson(liveriesJson);
|
||||
int c = liveries.size();
|
||||
const int c = liveries.size();
|
||||
this->m_liveryCache.set(liveries);
|
||||
|
||||
emit dataRead(CEntityFlags::LiveryEntity, CEntityFlags::ReadFinished, c);
|
||||
@@ -402,7 +402,7 @@ namespace BlackCore
|
||||
{
|
||||
CAircraftModelList models;
|
||||
models.convertFromJson(Json::jsonObjectFromString(modelsJson));
|
||||
int c = models.size();
|
||||
const int c = models.size();
|
||||
this->m_modelCache.set(models);
|
||||
|
||||
emit dataRead(CEntityFlags::ModelEntity, CEntityFlags::ReadFinished, c);
|
||||
@@ -417,7 +417,7 @@ namespace BlackCore
|
||||
{
|
||||
CDistributorList distributors;
|
||||
distributors.convertFromJson(Json::jsonObjectFromString(distributorsJson));
|
||||
int c = distributors.size();
|
||||
const int c = distributors.size();
|
||||
this->m_distributorCache.set(distributors);
|
||||
|
||||
emit dataRead(CEntityFlags::DistributorEntity, CEntityFlags::ReadFinished, c);
|
||||
@@ -473,6 +473,13 @@ namespace BlackCore
|
||||
if (entities.testFlag(CEntityFlags::DistributorEntity)) { this->m_distributorCache.synchronize(); }
|
||||
}
|
||||
|
||||
void CModelDataReader::admitCaches(CEntityFlags::Entity entities)
|
||||
{
|
||||
if (entities.testFlag(CEntityFlags::LiveryEntity)) { this->m_liveryCache.admit(); }
|
||||
if (entities.testFlag(CEntityFlags::ModelEntity)) { this->m_modelCache.admit(); }
|
||||
if (entities.testFlag(CEntityFlags::DistributorEntity)) { this->m_distributorCache.admit(); }
|
||||
}
|
||||
|
||||
void CModelDataReader::invalidateCaches(CEntityFlags::Entity entities)
|
||||
{
|
||||
if (entities.testFlag(CEntityFlags::LiveryEntity)) { CDataCache::instance()->clearAllValues(this->m_liveryCache.getKey()); }
|
||||
|
||||
Reference in New Issue
Block a user