Class TransactionalMap<K, V>

Map decorator that supports commit and rollback operations, any changes to the underlying map are only persisted when commit is called. Before any changes to the map are commited they can be reverted by calling rollback. A transaction is automaticlly started once any when calling delete, set or clear. At any given moment in time there can only be a single open transaction.

The transaction is implemented by creating a shallow clone from the target map; this is a less efficient implementation but has benefits when it comes to implementation complexcity

Type Parameters

  • K

  • V

Hierarchy

  • TransactionalMap

Implements

  • Map<K, V>

Constructors

Properties

inner: Map<K, V> = ...
pending: undefined | Map<K, V>

Accessors

Methods

  • Parameters

    • callbackfn: ((value, key, map) => void)
        • (value, key, map): void
        • Parameters

          • value: V
          • key: K
          • map: Map<K, V>

          Returns void

    • Optional thisArg: any

    Returns void