mCache

Additional

Language
Kotlin
Version
1.6 (Oct 23, 2017)
Created
Mar 26, 2017
Updated
Feb 14, 2018
Owner
viktor de pasquale (diareuse)
Contributors
codacy-badger
viktor de pasquale (diareuse)
2
Activity
Badge
Generate
Download
Source code
APK file

Show card

mCache

How do I use it?

Create it.

via Java:

public class App extends Application {

   @Override
   public void onCreate() {
    super.onCreate();
    Cache
      //.withGlobalMode(CacheMode.FILE)
      .with(this);
  }
}

via Kotlin:

class App : Application() {

  override fun onCreate() {
    super.onCreate()
    Cache
      //.withGlobalMode(CacheMode.FILE)
      .with(this)
  }
}

Save it.

via Java:

User user = new User();
Cache.give(user)
  //.ofIndex(username)
  //.ofMode(mode)
  .build()
  .getNow(); // or .getLater // or .getLaterWithFollowup

via Kotlin:

User().give()
  //.ofIndex { username }
  //.ofMode { mode }
  .build()
  .getNow() // or .getLater // or .getLaterWithFollowup

Get it.

via Java:

Cache.obtain(User.class)
  //.ofIndex(username)
  //.ofMode(mode)
  .build()
  .getNow(); // or .getLater // or .getLaterWithFollowup

via Kotlin:

obtain<User>()
  //.ofIndex { username }
  //.ofMode { mode }
  .build()
  .getNow() // or .getLater // or .getLaterWithFollowup

How easy is that?

Advanced tips

Wrap observables!

Cache.obtain(User::class.java)
  ...
  .getLaterWithFollowup(observable)

Customize

You can redo whole library yourself since it's now made entirely via interfaces.

Contributing

Fork me - make changes - reformat using this code style

Download

dependencies {
  compile 'wiki.depasquale:mcache:latest.release'
}

Snapshots

Add this to your build.gradle

repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}

And visit this link for the latest version

Licence

Copyright 2017 Viktor De Pasquale

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Created by Viktor De Pasquale in cooperation with Cortex spol. s.r.o.

Changelog