Nim-LibP2P Copyright (c) 2019 Status Research & Development GmbH
- Licensed under either of
- Apache License, version 2.0, (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option. This file may not be copied, modified, or distributed except according to those terms.
Types
TimedCache[K] = object of RootObj head, tail: TimedEntry[K] entries: Table[K, TimedEntry[K]] timeout: Duration
- Source Edit
TimedEntry[K] = ref object of RootObj key: K expiresAt: Moment next, prev: TimedEntry[K]
- Source Edit
Procs
func contains[K](t: TimedCache[K]; k: K): bool {....raises: [Defect].}
- Source Edit
func del[K](t: var TimedCache[K]; key: K): bool {....raises: [Defect].}
- Source Edit
func expire(t: var TimedCache; now: Moment = Moment.now()) {....raises: [Defect].}
- Source Edit
func init[K](T: type TimedCache[K]; timeout: Duration = Timeout): T:type {. ...raises: [Defect].}
- Source Edit
func put[K](t: var TimedCache[K]; k: K; now = Moment.now()): bool {. ...raises: [Defect].}
- Source Edit