Database finished

Added caches to the database and allowed for returns by distance as well as getting the closest cache.