foreseen

A text-based gemini browser with prefetching
git clone git://git.laack.co/foreseen.git
Log | Files | Refs | README | LICENSE

cache.hpp (417B)


      1 // cache for prior sites and such.
      2 #include <deque>
      3 #include <mutex>
      4 #include <optional>
      5 #include <unordered_map>
      6 
      7 #include "site.hpp"
      8 
      9 class Cache {
     10    private:
     11     void evict();
     12     std::unordered_map<std::string, Site> cache;
     13     std::mutex mutex;
     14     std::deque<std::string> evictionQueue;
     15 
     16    public:
     17     std::optional<Site> getSite(const std::string& site);
     18     void addSite(std::string address, Site site);
     19 };