1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-27 07:44:34 +02:00

Attempt to speed up infosystemcache loading on startup

This commit is contained in:
Jeff Mitchell
2011-04-16 03:03:59 -04:00
parent cdd3684dba
commit 9202113a43
2 changed files with 9 additions and 8 deletions

View File

@@ -43,7 +43,7 @@ InfoSystemCache::InfoSystemCache( QObject* parent )
QString cacheFile = cacheDir + '/' + QString::number( i );
QDir dir( cacheDir );
if( dir.exists() && QFile::exists( cacheFile ) )
loadCache( type, cacheFile );
QMetaObject::invokeMethod( this, "loadCache", Qt::AutoConnection, Q_ARG( Tomahawk::InfoSystem::InfoType, type ), Q_ARG( QString, cacheFile ) );
}
}
@@ -122,7 +122,7 @@ InfoSystemCache::updateCacheSlot( Tomahawk::InfoSystem::InfoCacheCriteria criter
void
InfoSystemCache::loadCache( InfoType type, const QString &cacheFile )
InfoSystemCache::loadCache( Tomahawk::InfoSystem::InfoType type, const QString &cacheFile )
{
qDebug() << Q_FUNC_INFO;
QSettings cachedSettings( cacheFile, QSettings::IniFormat );
@@ -157,7 +157,7 @@ InfoSystemCache::loadCache( InfoType type, const QString &cacheFile )
void
InfoSystemCache::saveCache( InfoType type, const QString &cacheDir )
InfoSystemCache::saveCache( Tomahawk::InfoSystem::InfoType type, const QString &cacheDir )
{
qDebug() << Q_FUNC_INFO;
QDir dir( cacheDir );

View File

@@ -48,10 +48,11 @@ public slots:
void getCachedInfoSlot( Tomahawk::InfoSystem::InfoCacheCriteria criteria, qint64 newMaxAge, QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, Tomahawk::InfoSystem::InfoCustomData customData );
void updateCacheSlot( Tomahawk::InfoSystem::InfoCacheCriteria criteria, qint64 maxAge, Tomahawk::InfoSystem::InfoType type, QVariant output );
private:
void loadCache( InfoType type, const QString &cacheFile );
void saveCache( InfoType type, const QString &cacheDir );
private slots:
void loadCache( Tomahawk::InfoSystem::InfoType type, const QString &cacheFile );
void saveCache( Tomahawk::InfoSystem::InfoType type, const QString &cacheDir );
private:
QHash< InfoType, QHash< InfoCacheCriteria, QVariant > > m_dataCache;
QHash< InfoType, QHash< InfoCacheCriteria, QDateTime > > m_insertTimeCache;
QHash< InfoType, QHash< InfoCacheCriteria, QDateTime > > m_maxTimeCache;