PluginProbe
Yatra – Travel Booking & Tour Operator Software / trunk
Yatra – Travel Booking & Tour Operator Software vtrunk
3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 2.0.10 2.0.11 All 82 releases
yatra / app / Repositories / GeocodingRepository.php

GeocodingRepository.php in Yatra – Travel Booking & Tour Operator Software trunk, at app/Repositories/GeocodingRepository.php

41 lines 992 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Yatra\Repositories;
6
7 use Yatra\Utils\Cache;
8
9 /**
10 * Geocoding response cache (Nominatim). Not DB-backed; centralizes cache keys for external lookups.
11 * Does not wrap {@see get_option()}.
12 */
13 final class GeocodingRepository
14 {
15 /**
16 * @param string $schema Bump when search API parameters change (busts stale cache).
17 */
18 public function cacheKeySearch(string $query, int $limit, string $schema = 'v4'): string
19 {
20 return 'yatra_geo_search_' . md5($query . '|' . $limit . '|' . $schema);
21 }
22
23 public function cacheKeyReverse(float $lat, float $lng): string
24 {
25 return 'yatra_geo_reverse_' . md5((string) $lat . '_' . (string) $lng);
26 }
27
28 /**
29 * @return mixed
30 */
31 public function getPayload(string $key)
32 {
33 return Cache::get($key);
34 }
35
36 public function setPayload(string $key, $value, int $ttlSeconds): bool
37 {
38 return Cache::set($key, $value, $ttlSeconds);
39 }
40 }
41