MVP-Routing-Implementation #1
Reference in New Issue
Block a user
Delete Branch "MVP-Routing-Implementation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
- Created cache/store.go with Cache interface, redisClient wrapper, cacheStore, TTL constants (CityTTL 30d, SearchNearTermTTL 3h, SearchFarTermTTL 7d) - Implemented cache keys: cities:{code}, stations:{id}, search:{from}:{to}:{date} - Implemented cache-aside pattern via CacheAside struct with GetOrSetFuncPattern, GetCity, GetStation, GetSearch - Added TTL-aware search result caching with near-term (3h) and far-term (7d) policies - Wrote 6 unit tests: CacheGetSet, CacheKeyString, CacheAsideGetOrSet, CacheAsideGetCity, CacheAsideGetSearch, CacheInvalidate - All tests pass with Redis integration- Create cmd/api/handlers.go with HTTP handlers for all MVP endpoints - Implement GET /v1/cities?query= city autocomplete - Implement GET /v1/cities/{id}/stations city stations including neighbors - Implement POST /v1/routes/search route search with Pareto-optimal results - Implement GET /v1/routes/{search_id}/{route_id}/geojson route geometry - Implement GET /v1/stations/{id}/status station status endpoint - Add handler tests with success and error cases - All existing tests pass