-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce LoadingStrategy for Dod (#43)
* Introduce LoadingStrategy for Dod --------- Co-authored-by: Artem Mochalov <artyom.mochalov@revolut.com>
- Loading branch information
1 parent
08423ed
commit 1ab0073
Showing
11 changed files
with
145 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
POM_ARTIFACT_ID=dfd | ||
VERSION_NAME=1.5.12 | ||
VERSION_NAME=1.5.13 | ||
POM_NAME=dfd | ||
POM_PACKAGING=jar | ||
GROUP=com.revolut.flowdata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
POM_ARTIFACT_ID=dod-wrapper | ||
VERSION_NAME=1.5.12 | ||
VERSION_NAME=1.5.13 | ||
POM_NAME=dod-wrapper | ||
POM_PACKAGING=jar | ||
GROUP=com.revolut.rxdata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
POM_ARTIFACT_ID=dod | ||
VERSION_NAME=1.5.12 | ||
VERSION_NAME=1.5.13 | ||
POM_NAME=dod | ||
POM_PACKAGING=jar | ||
GROUP=com.revolut.rxdata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
dod/src/main/java/com/revolut/rxdata/dod/LoadingStrategy.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.revolut.rxdata.dod | ||
|
||
/** | ||
* [DataObservableDelegate] observation loading strategy | ||
* | ||
* @param refreshMemory - if true data will be fetched from network even if there is something in the memory | ||
* @param refreshStorage - if true data will be fetched from network even if there is something in the storage | ||
*/ | ||
sealed class LoadingStrategy( | ||
internal val refreshMemory: Boolean, | ||
internal val refreshStorage: Boolean, | ||
) { | ||
/** | ||
* data will be fetched from the Network even if the data exists in the cache | ||
*/ | ||
object ForceReload: LoadingStrategy( | ||
refreshMemory = true, | ||
refreshStorage = true, | ||
) | ||
|
||
/** | ||
* data will not be fetched from the Network if the data exists in the memory cache | ||
*/ | ||
object Auto: LoadingStrategy( | ||
refreshMemory = false, | ||
refreshStorage = true, | ||
) | ||
|
||
/** | ||
* data will not be fetched from the Network if the data exists in the cache memory or storage | ||
*/ | ||
object LazyReload: LoadingStrategy( | ||
refreshMemory = false, | ||
refreshStorage = false, | ||
) | ||
} |
Oops, something went wrong.