@echo off REM 缓存测试脚本 (Windows版本) REM 使用方法: scripts\test_cache.bat [base_url] REM 默认base_url: http://localhost:8080 set BASE_URL=%1 if "%BASE_URL%"=="" set BASE_URL=http://localhost:8080 set API_BASE=%BASE_URL%/api/cache-test echo 🧪 开始缓存系统测试... echo 📍 测试地址: %BASE_URL% echo. REM 测试函数 :test_endpoint set method=%1 set endpoint=%2 set description=%3 echo 🔍 测试 %description%... if "%method%"=="GET" ( curl -s "%API_BASE%%endpoint%" ) else if "%method%"=="POST" ( curl -s -X POST "%API_BASE%%endpoint%" ) else if "%method%"=="DELETE" ( curl -s -X DELETE "%API_BASE%%endpoint%" ) if %errorlevel% equ 0 ( echo ✅ 成功 ) else ( echo ❌ 失败 ) echo. goto :eof REM 1. 测试缓存统计 call :test_endpoint GET /stats "缓存统计" REM 2. 测试基础缓存操作 call :test_endpoint GET /test "基础缓存操作" REM 3. 测试缓存键查询 call :test_endpoint GET /keys/gorm_cache:* "缓存键查询" REM 4. 测试性能测试 call :test_endpoint POST /performance "缓存性能测试" REM 5. 测试表缓存调试 call :test_endpoint GET /table/users "用户表缓存调试" echo 🎉 缓存测试完成! echo. echo 📋 测试结果说明: echo - 如果所有测试都返回200状态码,说明缓存系统正常工作 echo - 如果某些测试失败,请检查应用是否正在运行 echo - 查看应用日志获取更详细的调试信息 echo. echo 🔧 手动测试命令: echo curl %API_BASE%/stats echo curl %API_BASE%/test echo curl %API_BASE%/keys/gorm_cache:* echo curl -X POST %API_BASE%/performance echo curl %API_BASE%/table/users pause