Skip to content
alirezat775 edited this page Jul 21, 2019 · 3 revisions

kesho

create a new instance, need context kesh instance and cache type.

   val kesho = Kesho(this, Kesho.SHARED_PREFERENCES_MANAGER)

when enabling encryption data, add two parameters in a constructor, parameters include encrypt type and encrypt key

   val kesho = Kesho(this, Kesho.SHARED_PREFERENCES_MANAGER, Kesho.Encrypt.DESEDE_ENCRYPT,"_hello_world_secret_key_")

push data

   kesho.push(YOUR_KEY, your_value)

when store data with TTL(time to life), should be pass time

   kesho.push(YOUR_KEY, your_value, Kesho.ONE_HOURS)

pull data

   kesho.pull(YOUR_KEY, default_value)

when retrieving custom object class like data model, should be pass class type

   kesho.pull(KEY_OBJECT, default_value, SampleModel::class)

remove specific key

   kesho.remove(YOUR_KEY)

clear all key

   kesho.clear()

has specific key

   kesho.has(YOUR_KEY)

valid specific key

   kesho.valid(YOUR_KEY)

Clone this wiki locally