import { Cache , Maybe } from "../main" ; import LruMap from "collections/lru-map" ; export type Serialized = { key : string ; value : string ; } ; export class LruCache implements Cache { private _map : LruMap ; constructor ( size ) { this . _map = new LruMap ( { } , size ) ; } read = ( key ) : Maybe < string > => this . _map . get ( key ) || null ; write = ( key , value ) : LruMap => this . _map . set ( key , value ) ; }