- Manages space occupied by downloaded assets. Assets are grouped by category and sub-category.
- For this I have created 2 tables in Database for client:-
- DownloadedAssets (table name)
- string Category
- string sub-Category
- Asset Path
- CreationTimeStamp
- Size
- CategoryMaxSize (table name)
- string Category
- Max size
- DownloadedAssets (table name)
- Entity class:
- DownloadedAssets
- Category
- sub-category
- Filepath
- timestamp
- size
- DownloadedAssets
- There will be a lazy initialised singleton class named SpaceManagementService. How can i ensure lazy initialization.
- SpaceManagementService class will have following methods:-
- insertMaxsize(category, size)
- checkandInsertDownloadedAssets(DownloadedAssets obj) - This methods checks that total size of Assets under a category after adding obj if exceeds Maxsize limit then delete one entry at a time FIFO manner till total size < Max size
- RemoveMaxSize(category)
- RemoveCleanupAssets(category, subcategory)
This is the high level implementation. I am doing it in Objective-C for IOS. I need to make this like a library. Please suggest how can i implement this in a better way and some examples if possible.How do i take care of Atomicity of removing entry from database and file system.
Aucun commentaire:
Enregistrer un commentaire