summaryrefslogtreecommitdiff
path: root/src/lru_cache.sml
diff options
context:
space:
mode:
authorGravatar Ziv Scully <ziv@mit.edu>2015-11-13 01:04:32 -0500
committerGravatar Ziv Scully <ziv@mit.edu>2015-11-13 01:04:32 -0500
commitc38edb9bd5c21bcc1d21979d40ec8e9d638b6e9c (patch)
treef43a6a25889fa0c64c29a133e17755aff063704c /src/lru_cache.sml
parent06464bd07cb1efbc9df4ca650978c14f4c20390a (diff)
Fix issue with one-element caches. Locking still WIP.
Diffstat (limited to 'src/lru_cache.sml')
-rw-r--r--src/lru_cache.sml29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/lru_cache.sml b/src/lru_cache.sml
index b6ffe700..b66becb7 100644
--- a/src/lru_cache.sml
+++ b/src/lru_cache.sml
@@ -24,6 +24,9 @@ fun store (index, keys, value) =
fun flush (index, keys) =
ffiAppCache' ("flush", index, withTyp optionStringTyp keys)
+fun lock (index, write) =
+ ffiAppCache' ((if write then "w" else "r") ^ "lock", index, [])
+
(* Cjr *)
@@ -157,18 +160,18 @@ fun toyIfNoKeys numKeys implLru implToy args =
else implLru args
val cache =
- let
- val {check = toyCheck,
- store = toyStore,
- flush = toyFlush,
- setupQuery = toySetupQuery,
- ...} = ToyCache.cache
- in
- {check = toyIfNoKeys (length o #2) check toyCheck,
- store = toyIfNoKeys (length o #2) store toyStore,
- flush = toyIfNoKeys (length o #2) flush toyFlush,
- setupQuery = toyIfNoKeys #params setupQuery toySetupQuery,
- setupGlobal = setupGlobal}
- end
+ (* let *)
+ (* val {check = toyCheck, *)
+ (* store = toyStore, *)
+ (* flush = toyFlush, *)
+ (* setupQuery = toySetupQuery, *)
+ (* ...} = ToyCache.cache *)
+ (* in *)
+ (* {check = toyIfNoKeys (length o #2) check toyCheck, *)
+ (* store = toyIfNoKeys (length o #2) store toyStore, *)
+ (* flush = toyIfNoKeys (length o #2) flush toyFlush, *)
+ {check = check, store = store, flush = flush, lock = lock,
+ setupQuery = setupQuery, setupGlobal = setupGlobal}
+ (* end *)
end