Skip to content

Commit

Permalink
Get green in storage Readme test by commiting d'oh, update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
eveliotc committed Jul 13, 2013
1 parent fa4166c commit 32bc5d5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,20 @@ A simple in memory and persistent `Object` cache for Android.

<hr/>

Carbonite aims to deal with your data POJOs (JavaBeans folks anyone?) without boilerplate code, so you can forgforgetuet about ORMs, SQLite, `Cursor`s, `ContentProvider`s, etc. for data that you already hold in `Object`s anyways.
Carbonite aims to deal with your data POJOs (JavaBeans folks anyone?) without boilerplate code, so you can forget about
ORMs, SQLite, `Cursor`s, `ContentProvider`s, etc. for data that you already hold in `Object`s anyways.

Although it can be used as the only persistence solution on Android, *it is not* one of carbonite goals to do so, you should evaluate when traditional persistence solutions make more sense based on your problem.
Although it can be used as the only persistence solution on Android, *it is not* one of carbonite goals to do so,
you should evaluate when traditional persistence solutions make more sense based on your problem.

**Note**: Carbonite is currently under heavy first version development so API and stuff might change among versions, please bear with us.
**Note**: Carbonite is currently under heavy first version development so API and stuff might change among versions,
please bear with us.

### How does it work?

Carbonite keeps your POJOs in memory while transparently persisting them in background to storage, you can retrieve them later either from memory or loading them asynchronously/synchronously from storage.
Carbonite keeps your POJOs in memory while transparently persisting them in background to storage, you can retrieve them
later either from memory or loading them asynchronously/synchronously from storage. You can specify how and how long
are them kept, for finer control you can provide your own implementations.

### Usage
1. Include it in your project.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public StorageLruCache<T> set(String key, T value) {
if (!success) {
throw new IOException("Serializer failed to write.");
}
editor.commit();
} catch (IOException e) {
e(e, "Unable to set key %s to %s of type %s ", key, value, mType);
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
package info.evelio.carbonite;

import java.io.File;
import java.io.IOException;

import android.content.Context;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import java.lang.Exception;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

import static info.evelio.carbonite.Carbonite.CacheType.MEMORY;
import static info.evelio.carbonite.Carbonite.CacheType.STORAGE;

import static org.fest.assertions.api.Assertions.assertThat;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;

import static org.fest.assertions.api.Assertions.assertThat;

@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
public class ReadmeUsageTest {
Expand Down Expand Up @@ -116,7 +112,7 @@ private static void assertData(YourPojo data, String expected) {
assertThat(data.getData()).isEqualTo(expected);
}

private static class YourPojo {
public static class YourPojo {
private final String mData;

public YourPojo() {
Expand Down

0 comments on commit 32bc5d5

Please sign in to comment.