libp2p/protocols/pubsub/timedcache

    Dark Mode
Search:
Group by:
  Source   Edit

Nim-LibP2P Copyright (c) 2019 Status Research & Development GmbH

Licensed under either of

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

Consts

Timeout = (value: 10000000000)
  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