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