Interface: ObjectCache
In‑memory index of MoqtObject instances keyed by their Location (group/subgroup/object), providing ordered insertion and range queries.
Implementations MUST keep objects sorted ascending by (groupId, objectId) so binary searches can locate insertion points / range bounds efficiently. Subgroup ordinality is currently ignored for ordering (adjust if protocol semantics require finer granularity later).
Example
Typical usage
const cache: ObjectCache = new MemoryObjectCache()
cache.add(obj)
const window = cache.getRange(startLoc, endLoc)
const exact = cache.getByLocation(loc)Concurrency: Implementations here are not thread‑safe; callers avoid concurrent mutation from workers.
Methods
add()
add(
obj):void
Insert a new MoqtObject, preserving sorted order (duplicates allowed or replaced impl‑defined).
Parameters
obj
Returns
void
clear()
clear():
void
Remove all cached objects.
Returns
void
getByLocation()
getByLocation(
location):MoqtObject|undefined
Return the object whose Location exactly matches (group & object) or undefined if absent.
Parameters
location
Returns
MoqtObject | undefined
getRange()
getRange(
start?,end?):MoqtObject[]
Return a shallow copy array of objects whose Location is >= start and < end (end exclusive).
Parameters
start?
end?
Returns
size()
size():
number
Current number of cached objects.
Returns
number