forceCalendar/Docs
API Reference

PerformanceOptimizer

API reference for the PerformanceOptimizer class.

Internal utility. PerformanceOptimizer is not exported from the @forcecalendar/core package entry point and cannot be imported directly. It is used internally by EventStore and EnhancedCalendar — access its output through APIs such as calendar.eventStore.getPerformanceMetrics() or EnhancedCalendar's performance methods.

Constructor

new PerformanceOptimizer(options?: {
  eventCacheSize?: number,    // default 500
  queryCacheSize?: number,    // default 100
  dateRangeCacheSize?: number // default 50
})

Caching

MethodSignatureReturns
cache(key: string, value: any, type?: string) => void—
getFromCache(key: string, type?: string) => any | undefinedCached value
optimizeQuery(key: string, fn: Function) => anyQuery result

Cache types: 'event', 'query', 'dateRange'.

Metrics

MethodSignatureReturns
measure(operation: string, fn: Function) => anyFunction result
measureAsync(operation: string, fn: Function) => Promise<any>Function result
getMetrics() => objectAll metrics

Lazy Indexing

MethodSignatureReturns
shouldUseLazyIndexing(event: Event) => boolean—
createLazyIndexMarkers(event: Event) => void—
expandLazyIndex(eventId: string, start: Date, end: Date) => void—

Batch

MethodSignatureReturns
batch(operation: Function) => anyResult

Lifecycle

MethodSignatureReturns
destroy() => void—