finalizeEntry method

void finalizeEntry(
  1. CacheEntryInternal entry
)

Finalizes an entry after configuration.

This method should be called after an entry is fully configured to commit it to the cache with size tracking and compaction.

Implementation

void finalizeEntry(CacheEntryInternal entry) {
  entry.commit();

  // Update size tracking
  if (_options.sizeLimit != null && entry.size != null) {
    _currentSize += entry.size!;

    // Check if we need to compact
    if (_currentSize > _options.sizeLimit!) {
      compact(_options.compactionPercentage);
    }
  }
}