Commit 3b8c71f5 authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Add a cache to find_election

parent e4e4f7b5
......@@ -83,10 +83,21 @@ let web_election_data (raw_election, web_params) =
end in
let find_election uuid =
let raw_find_election uuid =
lwt x = Ocsipersist.find election_ptable uuid in
return (web_election_data x)
module WCacheTypes = struct
type key = string
type value = (module WEB_ELECTION_DATA)
module WCache = Ocsigen_cache.Make (WCacheTypes)
let find_election =
let cache = new WCache.cache raw_find_election 100 in
fun x -> cache#find x
(* Mutex to avoid simultaneous registrations of the same election *)
let registration_mutex = Lwt_mutex.create ()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment