cszawisza
17th June 2014, 16:59
Hi!
I'm now developing an application that saves some data in a DB. One of tables in that DB contains files for other associated tables. What I want to do is to generate a SHA256 hash for every file in the DB, and the application should check first if file with such hash is available on disk cache, and if file exists, get it from disk instead of download from the DB. Because those files will be needed in different places in application I decided to use a singleton class that will hold information about files cached on disk, and if some action is needed just ask the singleton class.
Is it good approach, or should I use different one? (setProperty, Q_GLOBAL_STATIC)
I'm now developing an application that saves some data in a DB. One of tables in that DB contains files for other associated tables. What I want to do is to generate a SHA256 hash for every file in the DB, and the application should check first if file with such hash is available on disk cache, and if file exists, get it from disk instead of download from the DB. Because those files will be needed in different places in application I decided to use a singleton class that will hold information about files cached on disk, and if some action is needed just ask the singleton class.
Is it good approach, or should I use different one? (setProperty, Q_GLOBAL_STATIC)