#include "include/Cache.hpp"

#define MS_IN_S 1000
#define US_IN_S (1000 * MS_IN_S)

Cache::Cache(int rate_hz) {
  cache_duration = std::chrono::microseconds(US_IN_S / rate_hz);
}

bool Cache::is_expired() {
  return ((clock::now() - last_update) > cache_duration);
}

void Cache::update() {
  last_update = clock::now();
}
