Target filter
Search Kotlin docs
  • Platforms
  • Tealium Prism Kotlin
core/com.tealium.prism.core.api.modules/DataLayer

DataLayer

interface DataLayer

The DataLayer is available to store key-value data that should be present on every event tracked through the Tealium SDK.

There are a variety of getter/setter methods to store/retrieve common data types. All methods operate on the Tealium thread.

For updating multiple entries at once, the transactionally method is available to use.

Properties

onDataRemoved
Link copied to clipboard
abstract val onDataRemoved: Subscribable<List<String>>

Returns a Subscribable object with which to receive notifications of DataLayer entries being removed.

onDataUpdated
Link copied to clipboard
abstract val onDataUpdated: Subscribable<DataObject>

Returns a Subscribable object with which to receive notifications of DataLayer entries being updated.

Functions

clear
Link copied to clipboard
abstract fun clear(): Single<TealiumResult<Unit>>

Removes all entries from the DataLayer.

get
Link copied to clipboard
abstract fun get(key: String): Single<TealiumResult<DataItem?>>

Gets a single DataItem if available.

abstract fun <T> get(key: String, converter: DataItemConverter<T>): Single<TealiumResult<T?>>

Retrieves a value of type T at the given key using the provided converter to convert from a DataItem to an instance of T

getAll
Link copied to clipboard
abstract fun getAll(): Single<TealiumResult<DataObject>>

Gets all entries in the DataLayer and returns them as a DataObject

getBoolean
Link copied to clipboard
abstract fun getBoolean(key: String): Single<TealiumResult<Boolean?>>

Retrieves a Boolean value at the given key.

getDataList
Link copied to clipboard
abstract fun getDataList(key: String): Single<TealiumResult<DataList?>>

Retrieves a DataList value at the given key.

getDataObject
Link copied to clipboard
abstract fun getDataObject(key: String): Single<TealiumResult<DataObject?>>

Retrieves a DataObject value at the given key.

getDouble
Link copied to clipboard
abstract fun getDouble(key: String): Single<TealiumResult<Double?>>

Retrieves a Double value at the given key.

getInt
Link copied to clipboard
abstract fun getInt(key: String): Single<TealiumResult<Int?>>

Retrieves an Int value at the given key.

getLong
Link copied to clipboard
abstract fun getLong(key: String): Single<TealiumResult<Long?>>

Retrieves a Long value at the given key.

getString
Link copied to clipboard
abstract fun getString(key: String): Single<TealiumResult<String?>>

Retrieves a String value at the given key.

put
Link copied to clipboard
abstract fun put(data: DataObject): Single<TealiumResult<Unit>>
abstract fun put(data: DataObject, expiry: Expiry): Single<TealiumResult<Unit>>

Attempts to update all key-value pairs from the data and inserts them into the DataStore.

abstract fun put(key: String, value: DataItem): Single<TealiumResult<Unit>>
abstract fun put(key: String, value: DataItem, expiry: Expiry): Single<TealiumResult<Unit>>

Puts a single key-value pair into the DataStore

abstract fun put(key: String, value: DataItemConvertible): Single<TealiumResult<Unit>>
abstract fun put(key: String, value: DataItemConvertible, expiry: Expiry): Single<TealiumResult<Unit>>

Stores a DataItemConvertible at the given key. The value will be eagerly converted to a DataItem on the caller thread.

abstract fun put(key: String, value: Boolean): Single<TealiumResult<Unit>>
abstract fun put(key: String, value: Boolean, expiry: Expiry): Single<TealiumResult<Unit>>

Stores a Boolean at the given key.

abstract fun put(key: String, value: Double): Single<TealiumResult<Unit>>
abstract fun put(key: String, value: Double, expiry: Expiry): Single<TealiumResult<Unit>>

Stores a Double at the given key.

abstract fun put(key: String, value: Int): Single<TealiumResult<Unit>>
abstract fun put(key: String, value: Int, expiry: Expiry): Single<TealiumResult<Unit>>

Stores an Int at the given key.

abstract fun put(key: String, value: Long): Single<TealiumResult<Unit>>
abstract fun put(key: String, value: Long, expiry: Expiry): Single<TealiumResult<Unit>>

Stores a Long at the given key.

abstract fun put(key: String, value: String): Single<TealiumResult<Unit>>
abstract fun put(key: String, value: String, expiry: Expiry): Single<TealiumResult<Unit>>

Stores a String at the given key.

remove
Link copied to clipboard
abstract fun remove(key: String): Single<TealiumResult<Unit>>

Removes the entry from the DataLayer, identified by the given key

abstract fun remove(keys: List<String>): Single<TealiumResult<Unit>>

Removes all entries from the DataLayer, identified by the given keys

transactionally
Link copied to clipboard
abstract fun transactionally(block: Callback<DataStore.Editor>): Single<TealiumResult<Unit>>

Allows editing of the DataLayer using a DataStore.Editor to enable more fine-grained control over key-value additions and removals.

Generated by Dokka
(c) Tealium 2026