//! Caching support to prevent hitting the API a lot.
use std::{fs, path::Path};
use thiserror::Error;
use xdg::BaseDirectories;
use super::APP_NAME;
#[derive(Error, Debug)]
pub enum CacheError {
#[error("Cache I/O error")]
Io(#[from] std::io::Error),
}
/// A generic cache.
pub trait Cache {
fn store(&mut self, path: &Path, data: &[u8]) -> Result<(), CacheError>;
fn get(&mut self, path: &Path) -> Result