CachedQueryBindings

abstract class CachedQueryBindings<K : Any>(nameOf: (K) -> AggregateType) : QueryBindings<K>

QueryBindings that create each key's binding once and reuse it, by the key's name (nameOf): a key that no longer equals the one its binding was created for (a dataset redeclared with another table or other columns) gets a binding of its own, and forget drops a name's binding. A key it does not serve is asked again each time.

createBinding must be cheap and free of side effects: callers racing on a name's first binding may each create one, and all but one are dropped. A binding that opens resources would need a cache that creates it once.

Inheritors

Constructors

Link copied to clipboard
constructor(nameOf: (K) -> AggregateType)

Functions

Link copied to clipboard
open override fun binding(key: K): QueryBackendBinding<QueryBackend>?

The binding of key, or null when this storage does not serve it.

Link copied to clipboard
open override fun forget(key: K)

Forgets what it holds for key, as when a dataset left; nothing for bindings that hold nothing.