aboutsummaryrefslogtreecommitdiff
path: root/src/modules/router/ticker.rs
blob: 5b44d41342eab24784894216fad90c66309f429f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
use crate::DATABASE;

pub fn module(context: &windmark::context::HookContext) {
  let url_path =
    if context.url.path().is_empty() { "/" } else { context.url.path() };
  let mut database = DATABASE.lock().unwrap();
  let current_hits = database.get::<i32>(url_path).unwrap_or(0);

  database.set(url_path, &(current_hits + 1)).unwrap();
}