scheduleAtTimes method

void scheduleAtTimes(
  1. List<TimeOfDay> times
)

Schedules eviction to run at specific times of day.

The times parameter is a list of times when eviction should run.

Implementation

void scheduleAtTimes(List<TimeOfDay> times) {
  if (_isRunning) {
    _log.warning('Scheduler is already running. Stop it first.');
    return;
  }

  if (times.isEmpty) {
    _log.warning('No times provided. Scheduling will not be effective.');
    return;
  }

  _scheduledTimes.clear();
  _scheduledTimes.addAll(times);
  _conditions.add(EvictionTiming.scheduled);
  _scheduleNextEviction();
  _isRunning = true;
  _log.info(
      'Scheduled eviction at specific times: ${times.map((t) => '${t.hour}:${t.minute}').join(', ')}');
}