EntityCache

class EntityCache(transaction: R2dbcTransaction)

Class responsible for the storage of Entity instances in a specific transaction.

Constructors

Link copied to clipboard
constructor(transaction: R2dbcTransaction)

Properties

Link copied to clipboard

The mapping of IdTables to associated Entity instances (as a mapping of entity id values to entities).

Functions

Link copied to clipboard
suspend fun clear(flush: Boolean = true)

Clears this EntityCache of all stored data, including any reference mappings.

Link copied to clipboard

Clears this EntityCache of stored data that maps cached parent entities to their referencing child entities.

Link copied to clipboard
fun <ID : Any, T : Entity<ID>> find(f: EntityClass<ID, T>, id: EntityID<ID>): T?

Searches this EntityCache for an Entity by its EntityID value using its associated EntityClass as the key.

Link copied to clipboard
fun <ID : Any, T : Entity<ID>> findAll(entityClass: EntityClass<ID, T>): List<T>

Gets all Entity instances in this EntityCache that match the associated EntityClass.

Link copied to clipboard
suspend fun flush()

Sends all pending inserts and updates for all Entity instances in this EntityCache to the database.

suspend fun flush(tables: Iterable<IdTable<*>>)

Sends all pending inserts and updates for Entity instances in this EntityCache to the database.

Link copied to clipboard
suspend fun <ID : Any, R : Entity<ID>> getOrPutReferrers(sourceId: EntityID<*>, key: Column<*>, refs: suspend () -> SizedIterable<R>): SizedIterable<R>

Returns a SizedIterable containing all child Entity instances that reference the parent entity with the provided sourceId using the specified key column.

Link copied to clipboard
fun <R : Entity<*>> getReferrers(sourceId: EntityID<*>, key: Column<*>): SizedIterable<R>?

Returns a SizedIterable containing all child Entity instances that reference the parent entity with the provided sourceId using the specified key column.

Link copied to clipboard
fun <ID : Any, T : Entity<ID>> remove(table: IdTable<ID>, o: T)

Removes the specified Entity from this EntityCache using its associated table as the key.

Link copied to clipboard
fun <ID : Any> scheduleInsert(klass: EntityClass<ID, Entity<ID>>, entity: Entity<ID>)

Stores the specified Entity in this EntityCache as scheduled to be inserted into the database.

Link copied to clipboard
fun <ID : Any> scheduleUpdate(klass: EntityClass<ID, Entity<ID>>, entity: Entity<ID>)

Stores the specified Entity in this EntityCache as scheduled to be updated in the database.

Link copied to clipboard
fun store(o: Entity<*>)

Stores the specified Entity in this cache.