mardi 17 janvier 2017

Downloaded Assets persistant memory management

  1. Manages space occupied by downloaded assets. Assets are grouped by category and sub-category.
  2. For this I have created 2 tables in Database for client:-
    1. DownloadedAssets (table name)
      1. string Category
      2. string sub-Category
      3. Asset Path
      4. CreationTimeStamp
      5. Size
    2. CategoryMaxSize (table name)
      1. string Category
      2. Max size
  3. Entity class:
    1. DownloadedAssets
      1. Category
      2. sub-category
      3. Filepath
      4. timestamp
      5. size
  4. There will be a lazy initialised singleton class named SpaceManagementService. How can i ensure lazy initialization.
  5. SpaceManagementService class will have following methods:-
    1. insertMaxsize(category, size)
    2. 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
    3. RemoveMaxSize(category)
    4. 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