EntityCache

class EntityCache(transaction: Transaction)

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

Constructors

Link copied to clipboard
constructor(transaction: Transaction)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

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

Link copied to clipboard

The amount of entities to store in this EntityCache per Entity class.

Functions

Link copied to clipboard
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

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

Link copied to clipboard
fun flush()

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

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

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

Link copied to clipboard
fun <ID : Any, R : Entity<ID>> getOrPutReferrers(sourceId: EntityID<*>, key: Column<*>, refs: () -> 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, T : Entity<ID>> scheduleInsert(f: EntityClass<ID, T>, o: T)

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

Link copied to clipboard
fun <ID : Any, T : Entity<ID>> scheduleUpdate(f: EntityClass<ID, T>, o: T)

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 EntityCache.

fun <ID : Any, T : Entity<ID>> store(f: EntityClass<ID, T>, o: T)

Stores the specified Entity in this EntityCache using its associated EntityClass as the key.