$termToRu, 'termToEn' => $termToEn, 'enToRu' => $enToRu, 'ruToEn' => $ruToEn, 'enToTerm' => $enToTerm, 'ruToTerm' => $ruToTerm ]; }); // Her bir mapping'i ayrı cache key'e kaydet Cache::put('termToRu', $mappings['termToRu'], 3600); Cache::put('termToEn', $mappings['termToEn'], 3600); Cache::put('enToRu', $mappings['enToRu'], 3600); Cache::put('ruToEn', $mappings['ruToEn'], 3600); Cache::put('enToTerm', $mappings['enToTerm'], 3600); Cache::put('ruToTerm', $mappings['ruToTerm'], 3600); return $mappings; } function convertMap() { $cacheKey = "converter_map_data"; // Önce cache'den okumayı dene if (Cache::has($cacheKey)) { $mappings = Cache::get($cacheKey); // Cache'den okunan veri geçerli mi kontrol et if (!empty($mappings) && is_array($mappings)) { return $mappings; } } // Cache yoksa veya geçersizse yeniden oluştur $mappings = j(setting("converter-map")); // Yeni veriyi cache'e kaydet if (!empty($mappings) && is_array($mappings)) { Cache::put($cacheKey, $mappings, 60); } return $mappings; } function convertRu($term) { // Önce cache'de mapping var mı kontrol et $converterMap = Cache::get('termToRu'); // Eğer cache'de yoksa, convertMapCache'i çağır if (empty($converterMap)) { convertMapCache(); $converterMap = Cache::get('termToRu'); } if(isset($converterMap[$term])) { return $converterMap[$term]; } else { Log::info("convertRu not found", ['term' => $term]); } return $term; } function convertEn($term) { // Önce cache'de mapping var mı kontrol et $converterMap = Cache::get('termToEn'); // Eğer cache'de yoksa, convertMapCache'i çağır if (empty($converterMap)) { convertMapCache(); $converterMap = Cache::get('termToEn'); } if(isset($converterMap[$term])) { return $converterMap[$term]; } return $term; } ?>