An easy to use android cache based on realm
.
No. | Type | Support |
---|---|---|
1 | string | √ |
Realm.init(this);
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder().migration(new RealmMigration() {
@Override
public void migrate(DynamicRealm realm, long oldVersion, long newVersion) {
Log.i(TAG, String.format("migrate: oldVersion = %d, newVersion = %d", oldVersion, newVersion));
}
}).schemaVersion(BuildConfig.VERSION_CODE).name("test").build();
Realm realm = Realm.getInstance(realmConfiguration);
ECache.init(realm);
ECache.get(key);
ECache.set(key, value, DateUtil.TIME_UNIT_MINUTE * 3);
ECache.delete(key);
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "io.realm:realm-gradle-plugin:2.2.1" // install realm plugin
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
dependencies {
compile 'com.github.aotian16:ECache:v3.0.0'
}
then
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "io.realm:realm-gradle-plugin:2.2.1" // install realm plugin
}
}
No. | Version | Detail |
---|---|---|
1 | 1.0.0 | first version |
2 | 2.0.0 | refactor |
3 | 3.0.0 | based on realm |
MIT