Skip to content

Instantly share code, notes, and snippets.

@k1dbl4ck
Created December 15, 2020 10:54
Show Gist options
  • Save k1dbl4ck/f1b34ef750f9620be064c53b2f8e0aa2 to your computer and use it in GitHub Desktop.
Save k1dbl4ck/f1b34ef750f9620be064c53b2f8e0aa2 to your computer and use it in GitHub Desktop.
class UserInfoRepository(
private val userInfoLocalDataSource: LocalDataSource<String, UserInfoDataModel>,
private val userInfoRemoteDataSource: RemoteDataSource<UserInfoDataModel>
) : CachePolicyRepository<UserInfoDataModel>(
localDataSource = userInfoLocalDataSource,
remoteDataSource = userInfoRemoteDataSource
) {
suspend fun get(key:String, cachePolicy: CachePolicy): UserInfoDomainModel {
val userInfo:UserInfo? = cacheFetch(key, cachePolicy)
// Do your mapping, etc. and return domain model
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment