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 ); QString cacheFile = cacheDir + '/' + QString::number( i );
QDir dir( cacheDir ); QDir dir( cacheDir );
if( dir.exists() && QFile::exists( cacheFile ) ) 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 void
InfoSystemCache::loadCache( InfoType type, const QString &cacheFile ) InfoSystemCache::loadCache( Tomahawk::InfoSystem::InfoType type, const QString &cacheFile )
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
QSettings cachedSettings( cacheFile, QSettings::IniFormat ); QSettings cachedSettings( cacheFile, QSettings::IniFormat );
@@ -157,7 +157,7 @@ InfoSystemCache::loadCache( InfoType type, const QString &cacheFile )
void void
InfoSystemCache::saveCache( InfoType type, const QString &cacheDir ) InfoSystemCache::saveCache( Tomahawk::InfoSystem::InfoType type, const QString &cacheDir )
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
QDir dir( cacheDir ); QDir dir( cacheDir );
@@ -201,4 +201,4 @@ InfoSystemCache::saveCache( InfoType type, const QString &cacheDir )
} //namespace InfoSystem } //namespace InfoSystem
} //namespace Tomahawk } //namespace Tomahawk

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 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 ); void updateCacheSlot( Tomahawk::InfoSystem::InfoCacheCriteria criteria, qint64 maxAge, Tomahawk::InfoSystem::InfoType type, QVariant output );
private: private slots:
void loadCache( InfoType type, const QString &cacheFile ); void loadCache( Tomahawk::InfoSystem::InfoType type, const QString &cacheFile );
void saveCache( InfoType type, const QString &cacheDir ); void saveCache( Tomahawk::InfoSystem::InfoType type, const QString &cacheDir );
private:
QHash< InfoType, QHash< InfoCacheCriteria, QVariant > > m_dataCache; QHash< InfoType, QHash< InfoCacheCriteria, QVariant > > m_dataCache;
QHash< InfoType, QHash< InfoCacheCriteria, QDateTime > > m_insertTimeCache; QHash< InfoType, QHash< InfoCacheCriteria, QDateTime > > m_insertTimeCache;
QHash< InfoType, QHash< InfoCacheCriteria, QDateTime > > m_maxTimeCache; QHash< InfoType, QHash< InfoCacheCriteria, QDateTime > > m_maxTimeCache;
@@ -62,4 +63,4 @@ private:
} //namespace Tomahawk } //namespace Tomahawk
#endif //TOMAHAWK_INFOSYSTEMCACHE_H #endif //TOMAHAWK_INFOSYSTEMCACHE_H