Added a cache system

Added a base caching system for recently made queries. It still migt
need some tweaking. Also created a base file with the basic BFS
algorithm. Next commit will have it's algo better suited to the current
problem