Library
Module
Module type
Parameter
Class
Class type
Rache is a library for resource caches.
More specifically, Rache provides modules implementing caches for resources. These caches are parametrised by cache-policies: replacement policy and maximum size. The caches also provide a clean-up mechanism to deal with resource tear-down.
module type TRANSFER = sig ... end
TRANSFER
are caches in which resources can be put and from which resources can be taken. More precisely, caches where the ownership of the resources (the responsibility to clean them up) can be transferred into and out of the cache.
module type BORROW = sig ... end
BORROW
are caches in which resources can be borrowed but never transferred. In other words, the cache retains ownership of all resources.
All caches of Rache have either the TRANSFER
interface (for caches with transfer of ownership) or the BORROW
interface (for caches with borrowing of resources). Their behaviour can be tweaked by the parameters below.
REPLACEMENT
is for defining the replacement policy of a cache. LRU
is for "Least Recently Used", meaning that when a supernumerary item is inserted in the cache, the least recently used item is removed to make room. FIFO
is for "First-In, First-Out" meaning that when a supernumerary item is inserted in the cache, the oldest inserted element is removed to make room.
module LRU : REPLACEMENT
module FIFO : REPLACEMENT
module Transfer
(R : REPLACEMENT)
(H : Hashtbl.HashedType) :
TRANSFER with type key = H.t
Transfer(R)(H)
is a TRANSFER
indexed by H
and govern by the replacement policy R
.
module Borrow
(R : REPLACEMENT)
(H : Hashtbl.HashedType) :
BORROW with type key = H.t
Borrow(R)(H)
is a BORROW
indexed by H
and govern by the replacement policy R
.
module EmptyTransferMap (H : Hashtbl.HashedType) : TRANSFER with type key = H.t
EmptyTransferMap(H)
is a transfer-map module but it only supports the empty map: a map with zero elements.
module SingletonTransferMap
(H : Hashtbl.HashedType) :
TRANSFER with type key = H.t
SingletonTransferMap(H)
is a transfer-map module but it only supports singleton maps: maps with at most one element.
module EmptyBorrowMap (H : Hashtbl.HashedType) : BORROW with type key = H.t
EmptyBorrowMap(H)
is a borrow-map module but it only supports the empty map: a map with zero elements.
module SingletonBorrowMap (H : Hashtbl.HashedType) : BORROW with type key = H.t
SingletonBorrowMap(H)
is a borrow-map module but it only supports singleton maps: maps with at most one element.