public int InitAnswers() { var dataSource = new KeyIndexedDataSource <Answer>(); dataSource.Initialize(_answersRepository.Active()); _cacheManager.Add(CacheConstants.CACHE_KEY_ANSWERS_DATA, dataSource); return(dataSource.Size); }
private KeyIndexedDataSource <Answer> GetCachedData() { object data = _cacheManager.Get(CacheConstants.CACHE_KEY_ANSWERS_DATA); if (data == null) { var dataSource = new KeyIndexedDataSource <Answer>(); dataSource.Initialize(_repository.Active()); _cacheManager.Add(CacheConstants.CACHE_KEY_ANSWERS_DATA, dataSource); return(dataSource); } return((KeyIndexedDataSource <Answer>)data); }