package com.sundot.airport.web.controller.cache;

import com.sundot.airport.common.core.controller.BaseController;
import com.sundot.airport.common.core.domain.AjaxResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 统计缓存缓存管理控制器
 */
@Slf4j
@RestController
@RequestMapping("/statistics/cache")
public class StatisticsCacheController extends BaseController {

    /**
     * 清理统计缓存
     */
    @PostMapping("/clearStatistics")
    @CacheEvict(value = {
            "statistics_data",
            "statistics_list",
            "item_station",
            "item_ranking_detail",
            "item_duration",
            "item_seizure_trend",
            "attendance_station",
            "attendance_open_trend",
            "base_module_info"
    }, allEntries = true)
    public AjaxResult clearStatisticsCache() {
        return AjaxResult.success("统计缓存清理成功");
    }

}
