Update route_cache.py

Optimized bfs using parent ids
Added time based route expiration