CacheManager API - GeekBrainsPracticeTeam2/AndroidClient GitHub Wiki
CacheManager class solves problems of updating cached dictionaries and retrieving actual data from REST-service.
v.0.7
Constractor CacheManager cacheManager = new CacheManager(Context context); Context is needed to create DBHelper.
Method checkUpdates(String table) - check, if update for table needed? As table param you should set table name from DBHelper class. It is DBHelper.TB_SITES_NAME and DBHelper.TB_PERSONS_NAMES. Returns true or false.
Method updateDictionary(String table) - retrieve and store in cache actual dictionaries. As table param you should set table name from DBHelper class. It is DBHelper.TB_SITES_NAME and DBHelper.TB_PERSONS_NAMES
v. 1.0
Method getSitesDictionary() - return List<DictionarySites>
It checks if update for dictionary is needed, and update table.
Method getPersonsDictionary() - return List<DictionaryPersons>
It checks if update for dictionary is needed, and update table.
v. 1.1
Method getTotalStats() - return List<TotalStatistics>
It is not check updates, cause it get actual information right form REST-service.
v. 1.2
Method getTotalStatisticsBySite(int siteId) - return TotalStatistics
object for required siteId (from dictionary) or null if not found.