Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
Preparing release
Browse files Browse the repository at this point in the history
  • Loading branch information
iagocanalejas committed Feb 18, 2017
2 parents cfea352 + ff2786d commit 7eaa561
Show file tree
Hide file tree
Showing 22 changed files with 1,526 additions and 636 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
/build
/captures
.externalNativeBuild
.idea/vcs.xml
231 changes: 231 additions & 0 deletions .idea/codeStyleSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 64 additions & 16 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# NEXT
- Method `getCachingSystem()` added to `CachedCallFactory` class
# 1.2
- Renaming CachedCall<T> into Cached<T>
- Make RequestBuilder and ResponseUtils inner classes of CachedCall
- Implemented new tests matching Retrofit.
- Sync calls now are also cached

# 1.1.1
- Added `clone()` method to `CachedCall` interface to avoid extra casting.
Expand Down
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies {
public interface ApiService {

@GET("/")
CachedCall<MyObject> getResource();
Cached<MyObject> getResource();

}
```
Expand Down Expand Up @@ -70,24 +70,29 @@ dependencies {
For see default values in this caches take a look at [RetroCache](retrocache/src/main/java/com/andiag/retrocache/cache/RetroCache.java)

**Important**
- APP_VERSION is a static integer. When APP_VERSION changes all caches are automatically cleared. It's recommended to use BuildConfig.VERSION_CODE as BuildConfig.VERSION_CODE
- APP_VERSION is a static integer. When APP_VERSION changes the cache is automatically cleared. It's recommended to use BuildConfig.VERSION_CODE as APP_VERSION
3. Add the cache to your Retrofit service.
```java
retrofitBuilder.addCallAdapterFactory(new CachedCallFactory(mCache));
retrofitBuilder.addCallAdapterFactory(new CachedCallAdapterFactory(mCache));
```
4. Use it as normal retrofit. Just remember to use `CachedCall`. All retrofit methods are included, and you can also call `refresh(callback)` to avoid looking in the cache or `remove()` to invalidate a cached call.
4. Use it as normal retrofit. Just remember to use `Cached`. All retrofit methods are included, and you can also use methods explained in `Included` section.
# Included
In addition to normal retrofit usage you can also call `refresh(callback)` to avoid looking in the cache or `remove()` to invalidate a cached call.
```java
CachedCall<MyObject> call = ...
call.refresh(new Callback<MyObject>() {
...
});
call.remove();
Cached<MyObject> call = ...
call.refresh(new Callback<MyObject>() {
...
});
call.remove();
```
**This feature is by default enabled to `@GET` and disabled for the rest of methods.**
# Pull Requests
I welcome and encourage all pull requests. Here are some basic rules to follow to ensure timely addition of your request:
1. Match coding style (braces, spacing, etc.) This is best achieved using CMD+Option+L (on Mac) or Ctrl+Alt+L on Windows to reformat code with Android Studio defaults.
Expand Down
Loading

0 comments on commit 7eaa561

Please sign in to comment.