new BaseCollection
src/basecollection.ts:159new BaseCollection<K, V>(__namedParameters?: BaseCollectionOptions)A Map-like collection with array-style helpers, an optional size limit (least recently used are evicted first) and optional expiry.
import { BaseCollection } from 'detritus-utils';new BaseCollection<K, V>(__namedParameters?: BaseCollectionOptions)If the expiry interval is running, only while items expire and the collection isn't empty
_hasExpired(key: K): boolean[iterator](): IterableIterator<[K, V]>clear(): voidclone(): BaseCollection<K, V>delete(key: K): booleanentries(): IterableIterator<[K, V]>every(func: (v: V, k: K) => boolean): booleanevict(room?: number): voidEvicts the least recently used items until there's room free under the limit
filter(func: (v: V, k: K) => boolean): V[]find(func: (v: V, k: K) => boolean): V | undefinedfirst(): V | undefinedforEach(func: (v: V, k: K, map: Map<K, V>) => void, thisArg?: any): voidget(key: K): V | undefinedgetOrder(): Map<K, true>The recency order (least recently used first), synced with the cache untracked keys (added while limit was Infinity) count as the least recently used
getOrInsert(key: K, defaultValue: V): VgetOrInsertComputed(key: K, func: (key: K) => V): Vhas(key: K): booleanjoin(separator?: string): stringkeys(): IterableIterator<K>map(func: (v: V, k: K) => any): any[]reduce(func: (intial: any, v: V) => any, initialValue?: any): anyset(key: K, value: V): thissetExpire(value: number): thissetIntervalTimeout(value: number): thissetLimit(value: number): thissome(func: (v: V, k: K) => boolean): booleansort(func?: (x: V, y: V) => number): V[]startInterval(): voidstopInterval(): voidsweep(): numberDeletes every expired item now, returns how many were deleted
toArray(): V[]toJSON(): V[]toString(): stringtouch(key: K): voidvalues(): IterableIterator<V>