suparnatural-cache / com.suparnatural.core.cache / RawCacheable

RawCacheable

data class RawCacheable : Cacheable

A container to hold raw version for a cached object read from a persistent store. For example, in case of a disk store, key is the file name and value is the file contents. This is the first Cacheable object passed to the preprocessor chain. Therefore, your first preprocessor should expect RawCacheable as the input to CacheStorePreprocessor.unarchive method.

Constructors

<init>

RawCacheable(key: String, value: String)

A container to hold raw version for a cached object read from a persistent store. For example, in case of a disk store, key is the file name and value is the file contents. This is the first Cacheable object passed to the preprocessor chain. Therefore, your first preprocessor should expect RawCacheable as the input to CacheStorePreprocessor.unarchive method.

Properties

key

val key: String

the key to identify this object with.

value

val value: String

the serialized version of the cached object

Functions

cacheKey

fun cacheKey(): String

Returns the unique key used to identify the object in the cache.

serializeForPersistence

fun serializeForPersistence(): String

Returns a serialized string which can be persisted. If this is the last object returned by the preprocessor chain, the return value of this method will be persisted as it is. Otherwise, this method will not called.