Commit 65095748 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Clear cache when releasing the media library

parent 832c0ea0
......@@ -119,6 +119,12 @@ class Cache
return destroy( dbConnection, key );
}
static void clear()
{
std::lock_guard<std::mutex> lock( Mutex );
Store.clear();
}
private:
static std::unordered_map<typename CACHEPOLICY::KeyType, std::shared_ptr<IMPL> > Store;
static std::mutex Mutex;
......
......@@ -12,6 +12,16 @@ MediaLibrary::MediaLibrary()
{
}
MediaLibrary::~MediaLibrary()
{
File::clear();
Label::clear();
Album::clear();
AlbumTrack::clear();
Show::clear();
ShowEpisode::clear();
}
bool MediaLibrary::initialize(const std::string& dbPath)
{
int res = sqlite3_open( dbPath.c_str(), &m_dbConnection );
......
......@@ -9,6 +9,7 @@ class MediaLibrary : public IMediaLibrary
{
public:
MediaLibrary();
~MediaLibrary();
virtual bool initialize( const std::string& dbPath );
virtual bool files( std::vector<FilePtr>& res );
virtual FilePtr file( const std::string& path );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment