# FullKeyValuesCacheRepo

open class FullKeyValuesCacheRepo < Key , Value >(kvsRepo: KeyValuesRepo < Key , Value >, kvCache: KeyValueRepo < Key , List < Value >>, scope: CoroutineScope = CoroutineScope(Dispatchers.Default), skipStartInvalidate: Boolean = false, locker: SmartRWLocker = SmartRWLocker(writeIsLocked = !skipStartInvalidate)) : KeyValuesRepo < Key , Value > , FullReadKeyValuesCacheRepo < Key , Value > , WriteKeyValuesRepo < Key , Value > (source)

## Constructors

FullKeyValuesCacheRepo
Link copied to clipboard
constructor(kvsRepo: KeyValuesRepo < Key , Value >, kvCache: KeyValueRepo < Key , List < Value >>, scope: CoroutineScope = CoroutineScope(Dispatchers.Default), skipStartInvalidate: Boolean = false, locker: SmartRWLocker = SmartRWLocker(writeIsLocked = !skipStartInvalidate))

## Properties

onDataCleared
Link copied to clipboard
open override val onDataCleared : Flow< Key >

Flow that emits when all data for a key is cleared.

onNewValue
Link copied to clipboard
open override val onNewValue : Flow< Pair < Key , Value >>

Flow that emits when a new value is added to a key.

onValueRemoved
Link copied to clipboard
open override val onValueRemoved : Flow< Pair < Key , Value >>

Flow that emits when a value is removed from a key.

## Functions

add
Link copied to clipboard
open suspend override fun add (toAdd: Map < Key , List < Value >>)

Adds values to the specified keys.

add
Link copied to clipboard
inline suspend fun < Key , Value > WriteKeyValuesRepo < Key , Value >. add (k: Key , v: List < Value >)

Single-key overload of WriteKeyValuesRepo.add accepting a list of values.

inline suspend fun < Key , Value > WriteKeyValuesRepo < Key , Value >. add (k: Key , vararg v: Value )

Single-key vararg overload of WriteKeyValuesRepo.add.

applyDiff
Link copied to clipboard
suspend fun < Id , Registered > KeyValuesRepo < Id , Registered >. applyDiff (diff: MapDiff < Id , List < Registered >>)

Applies the given diff to this KeyValuesRepo: clears keys in MapDiff.removed, sets entries in MapDiff.changed and MapDiff.added.

suspend fun < Id , Registered > KeyValuesRepo < Id , Registered >. applyDiff (other: Map < Id , List < Registered >>)

Computes the diff between this KeyValuesRepo and other, then applies the diff to this repo.

asKeyValueRepo
Link copied to clipboard
fun < K , V > KeyValuesRepo < K , V >. asKeyValueRepo (): KeyValueFromKeyValuesRepo < K , V >

Wraps this KeyValuesRepo as a KeyValueFromKeyValuesRepo, exposing a full read-write key-value interface where each key maps to a List of values.

asReadKeyValueRepo
Link copied to clipboard
fun < K , V > ReadKeyValuesRepo < K , V >. asReadKeyValueRepo (): ReadKeyValueFromKeyValuesRepo < K , V >

Wraps this ReadKeyValuesRepo as a ReadKeyValueFromKeyValuesRepo, exposing each key mapped to a List of all associated values.

cached
Link copied to clipboard
fun < Key , Value > ReadKeyValuesRepo < Key , Value >. cached (kvCache: KVCache < Key , List < Value >>, locker: SmartRWLocker = SmartRWLocker()): ReadKeyValuesCacheRepo < Key , Value >
fun < Key , Value > KeyValuesRepo < Key , Value >. cached (kvCache: KVCache < Key , List < Value >>, scope: CoroutineScope = CoroutineScope(Dispatchers.Default), locker: SmartRWLocker = SmartRWLocker()): KeyValuesCacheRepo < Key , Value >
fun < Key , Value > ReadKeyValuesRepo < Key , Value >. cached (kvCache: KeyValueRepo < Key , List < Value >>, locker: SmartRWLocker = SmartRWLocker()): FullReadKeyValuesCacheRepo < Key , Value >
caching
Link copied to clipboard
fun < Key , Value > WriteKeyValuesRepo < Key , Value >. caching (kvCache: KeyValueRepo < Key , List < Value >>, scope: CoroutineScope = CoroutineScope(Dispatchers.Default), locker: SmartRWLocker = SmartRWLocker()): FullWriteKeyValuesCacheRepo < Key , Value >
clear
Link copied to clipboard
open suspend override fun clear (k: Key )

Fully clears all data associated with the specified key.

clearWithValue
Link copied to clipboard
open suspend override fun clearWithValue (v: Value )

Clears a specific value from all keys and removes those keys if they become empty.

contains
Link copied to clipboard
open suspend fun contains (k: Key ): Boolean

Checks if the specified key exists in the repository.

open suspend fun contains (k: Key , v: Value ): Boolean

Checks if the specified key-value pair exists in the repository.

count
Link copied to clipboard
open suspend fun count (): Long

Returns the total count of key-value pairs in the repository.

open suspend fun count (k: Key ): Long

Returns the count of values associated with the specified key.

diff
Link copied to clipboard
suspend fun < Id , Registered > ReadKeyValuesRepo < Id , Registered >. diff (other: Map < Id , List < Registered >>): MapDiff < Id , List < Registered >>

Computes the difference between all entries in this ReadKeyValuesRepo and the given other map.

directlyCached
Link copied to clipboard
fun < Key , Value > ReadKeyValuesRepo < Key , Value >. directlyCached (kvCache: KeyValueRepo < Key , List < Value >>, locker: SmartRWLocker = SmartRWLocker()): DirectFullReadKeyValuesCacheRepo < Key , Value >
fun < Key , Value > WriteKeyValuesRepo < Key , Value >. directlyCached (kvCache: KeyValueRepo < Key , List < Value >>, scope: CoroutineScope = CoroutineScope(Dispatchers.Default), locker: SmartRWLocker = SmartRWLocker()): DirectFullWriteKeyValuesCacheRepo < Key , Value >
directlyFullyCached
Link copied to clipboard
fun < Key , Value > KeyValuesRepo < Key , Value >. directlyFullyCached (kvCache: KeyValueRepo < Key , List < Value >> = MapKeyValueRepo(), scope: CoroutineScope = CoroutineScope(Dispatchers.Default), skipStartInvalidate: Boolean = false, locker: SmartRWLocker = SmartRWLocker()): DirectFullKeyValuesCacheRepo < Key , Value >
fullyCached
Link copied to clipboard
fun < Key , Value > KeyValuesRepo < Key , Value >. fullyCached (kvCache: KeyValueRepo < Key , List < Value >> = MapKeyValueRepo(), scope: CoroutineScope = CoroutineScope(Dispatchers.Default), skipStartInvalidate: Boolean = false, locker: SmartRWLocker = SmartRWLocker()): FullKeyValuesCacheRepo < Key , Value >
get
Link copied to clipboard
open suspend fun get (k: Key , pagination: Pagination , reversed: Boolean = false): PaginationResult < Value >

Retrieves a paginated list of values associated with the given key.

getAll
Link copied to clipboard
open suspend fun getAll (reverseLists: Boolean = false): Map < Key , List < Value >>

WARNING!!! THIS METHOD PROBABLY IS NOT EFFICIENT, USE WITH CAUTION

open suspend fun getAll (k: Key , reversed: Boolean = false): List < Value >
invalidate
Link copied to clipboard
open suspend override fun invalidate ()

Invalidates its internal data. It may lead to autoreload of data. In case when repo makes autoreload, it must do loading of data before clear

keys
Link copied to clipboard
open suspend fun keys (pagination: Pagination , reversed: Boolean = false): PaginationResult < Key >

Retrieves a paginated list of keys.

open suspend fun keys (v: Value , pagination: Pagination , reversed: Boolean = false): PaginationResult < Key >

Retrieves keys that have the specified value associated with them.

maxPagePagination
Link copied to clipboard
inline suspend fun ReadKeyValuesRepo <*, *>. maxPagePagination (): SimplePagination

Creates a pagination starting from the first page with size equal to the total count of items in this ReadKeyValuesRepo. This effectively creates a single page containing all items.

remove
Link copied to clipboard
open suspend override fun remove (toRemove: Map < Key , List < Value >>)

Removes specific values from keys without clearing all data for those keys.

remove
Link copied to clipboard
inline suspend fun < Key , Value > WriteKeyValuesRepo < Key , Value >. remove (keysAndValues: List < Pair < Key , List < Value >>>)

List-of-pairs overload of WriteKeyValuesRepo.remove.

inline suspend fun < Key , Value > WriteKeyValuesRepo < Key , Value >. remove (vararg keysAndValues: Pair < Key , List < Value >>)

Vararg overload of WriteKeyValuesRepo.remove.

inline suspend fun < Key , Value > WriteKeyValuesRepo < Key , Value >. remove (k: Key , v: List < Value >)

Single-key overload of WriteKeyValuesRepo.remove accepting a list of values.

inline suspend fun < Key , Value > WriteKeyValuesRepo < Key , Value >. remove (k: Key , vararg v: Value )

Single-key vararg overload of WriteKeyValuesRepo.remove.

removeWithValue
Link copied to clipboard
open suspend override fun removeWithValue (v: Value )

Removes a specific value from all keys that contain it, without clearing all data for those keys.

set
Link copied to clipboard
open suspend override fun set (toSet: Map < Key , List < Value >>)

Sets the values for specified keys, clearing any existing values first.

set
Link copied to clipboard
inline suspend fun < Key , Value > WriteKeyValuesRepo < Key , Value >. set (k: Key , v: List < Value >)

Single-key overload of WriteKeyValuesRepo.set accepting a list of values.

inline suspend fun < Key , Value > WriteKeyValuesRepo < Key , Value >. set (k: Key , vararg v: Value )

Single-key vararg overload of WriteKeyValuesRepo.set.

withMapper
Link copied to clipboard
inline fun < FromKey , FromValue , ToKey , ToValue > KeyValuesRepo < ToKey , ToValue >. withMapper (mapper: MapperRepo < FromKey , FromValue , ToKey , ToValue >): KeyValuesRepo < FromKey , FromValue >

Wraps this KeyValuesRepo with a MapperRepo to expose a mapped KeyValuesRepo.

inline fun < FromKey , FromValue , ToKey , ToValue > ReadKeyValuesRepo < ToKey , ToValue >. withMapper (mapper: MapperRepo < FromKey , FromValue , ToKey , ToValue >): ReadKeyValuesRepo < FromKey , FromValue >

Wraps this ReadKeyValuesRepo with a MapperRepo to expose a mapped ReadKeyValuesRepo.

inline fun < FromKey , FromValue , ToKey , ToValue > WriteKeyValuesRepo < ToKey , ToValue >. withMapper (mapper: MapperRepo < FromKey , FromValue , ToKey , ToValue >): WriteKeyValuesRepo < FromKey , FromValue >

Wraps this WriteKeyValuesRepo with a MapperRepo to expose a mapped WriteKeyValuesRepo.

inline fun < FromKey , FromValue , ToKey , ToValue > KeyValuesRepo < ToKey , ToValue >. withMapper (noinline keyFromToTo: suspend FromKey .() -> ToKey = { this as ToKey }, noinline valueFromToTo: suspend FromValue .() -> ToValue = { this as ToValue }, noinline keyToToFrom: suspend ToKey .() -> FromKey = { this as FromKey }, noinline valueToToFrom: suspend ToValue .() -> FromValue = { this as FromValue }): KeyValuesRepo < FromKey , FromValue >

Wraps this KeyValuesRepo with inline conversion lambdas to expose a mapped KeyValuesRepo.

inline fun < FromKey , FromValue , ToKey , ToValue > ReadKeyValuesRepo < ToKey , ToValue >. withMapper (noinline keyFromToTo: suspend FromKey .() -> ToKey = { this as ToKey }, noinline valueFromToTo: suspend FromValue .() -> ToValue = { this as ToValue }, noinline keyToToFrom: suspend ToKey .() -> FromKey = { this as FromKey }, noinline valueToToFrom: suspend ToValue .() -> FromValue = { this as FromValue }): ReadKeyValuesRepo < FromKey , FromValue >

Wraps this ReadKeyValuesRepo with inline conversion lambdas to expose a mapped ReadKeyValuesRepo.

inline fun < FromKey , FromValue , ToKey , ToValue > WriteKeyValuesRepo < ToKey , ToValue >. withMapper (noinline keyFromToTo: suspend FromKey .() -> ToKey = { this as ToKey }, noinline valueFromToTo: suspend FromValue .() -> ToValue = { this as ToValue }, noinline keyToToFrom: suspend ToKey .() -> FromKey = { this as FromKey }, noinline valueToToFrom: suspend ToValue .() -> FromValue = { this as FromValue }): WriteKeyValuesRepo < FromKey , FromValue >

Wraps this WriteKeyValuesRepo with inline conversion lambdas to expose a mapped WriteKeyValuesRepo.