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:
Klaus Basan
2016-10-28 03:04:15 +02:00
parent f385e46d67
commit de7821ff86
13 changed files with 83 additions and 24 deletions

View File

@@ -181,17 +181,17 @@ namespace BlackCore
void CIcaoDataReader::ps_aircraftIcaoCacheChanged()
{
// void
this->cacheHasChanged(CEntityFlags::AircraftIcaoEntity);
}
void CIcaoDataReader::ps_airlineIcaoCacheChanged()
{
// void
this->cacheHasChanged(CEntityFlags::AirlineIcaoEntity);
}
void CIcaoDataReader::ps_countryCacheChanged()
{
// void
this->cacheHasChanged(CEntityFlags::CountryEntity);
}
void CIcaoDataReader::ps_baseUrlCacheChanged()
@@ -400,6 +400,13 @@ namespace BlackCore
if (entities.testFlag(CEntityFlags::CountryEntity)) { this->m_countryCache.synchronize(); }
}
void CIcaoDataReader::admitCaches(CEntityFlags::Entity entities)
{
if (entities.testFlag(CEntityFlags::AircraftIcaoEntity)) { this->m_aircraftIcaoCache.admit(); }
if (entities.testFlag(CEntityFlags::AirlineIcaoEntity)) { this->m_airlineIcaoCache.admit(); }
if (entities.testFlag(CEntityFlags::CountryEntity)) { this->m_countryCache.admit(); }
}
void CIcaoDataReader::invalidateCaches(CEntityFlags::Entity entities)
{
if (entities.testFlag(CEntityFlags::AircraftIcaoEntity)) { CDataCache::instance()->clearAllValues(this->m_aircraftIcaoCache.getKey()); }