Skip to content
Snippets Groups Projects
Unverified Commit 48961330 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Make cache API public

parent cf3ec3ed
No related branches found
No related tags found
No related merge requests found
......@@ -59,21 +59,21 @@ struct Cache {
}
impl Cache {
fn new() -> Cache {
pub fn new() -> Cache {
Cache {
user_tokens: HashMap::new()
}
}
fn load_user_token(&self, owner: String) -> Option<&UserToken> {
pub fn load_user_token(&self, owner: String) -> Option<&UserToken> {
return self.user_tokens.get(&owner);
}
fn save_user_token(&self, owner: String, token: UserToken) {
pub fn save_user_token(&self, owner: String, token: UserToken) {
self.user_tokens.insert(owner, token);
}
fn cleanup_tokens(&self) {
pub fn cleanup_tokens(&self) {
for (owner, token) in self.user_tokens {
if token.is_expired() {
self.user_tokens.remove(&owner);
......@@ -83,5 +83,5 @@ impl Cache {
}
lazy_static! {
static ref CACHE: Cache = Cache::new();
pub static ref CACHE: Cache = Cache::new();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment