======================================== Testing Optimized Episode Fetching With Cached Drama Metadata ======================================== 1. Caching drama metadata...
Class "App\Services\DramaDataService" not found
dev-utils/test_cached_drama_optimization.php
22echo "With Cached Drama Metadata\n";
23echo "========================================\n\n";
24
25// Step 1: Ensure drama is cached
26echo "1. Caching drama metadata...\n";
27$dramaService = new DramaDataService();
28$dramaDetails = $dramaService->getDramaDetails($bookId, $lang);
29echo " ✓ Drama cached with " . count($dramaDetails['drama']['chapters'] ?? []) . " episodes\n\n";
30
31// Step 2: Clear episode cache to force fresh fetch
32$episodeCacheKey = "episode:v1:{$bookId}:{$episodeIndex}:{$lang}:1";
33Cache::forget($episodeCacheKey);
34echo "2. Episode cache cleared\n\n";
35
36// Step 3: Fetch episode (should only call video API)
37echo "3. Fetching episode {$episodeIndex}...\n";
38echo " Expected: 1 API call (video only)\n";
39