package ru.micord.ervu.security.esia.token;

import net.javacrumbs.shedlock.core.SchedulerLock;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Eduard Tihomirov
 */
@Service
public class TokensClearShedulerService {
  @Scheduled(cron = "${esia.token.clear.cron:0 0 */1 * * *}")
  @SchedulerLock(name = "clearToken")
  @Transactional
  public void load() {
    TokensStore.removeExpiredRefreshToken();
    TokensStore.removeExpiredAccessToken();
  }
}
