Note the MemoryCircuitBreakerStorageAdapter is limited to single process usage and cannot be shared across multiple servers or different processes. This adapter is meant for testing.
MemoryCircuitBreakerStorageAdapter
IMPORT_PATH: "@daiso-tech/core/circuit-breaker/memory-circuit-breaker-storage-adapter"
"@daiso-tech/core/circuit-breaker/memory-circuit-breaker-storage-adapter"
import { MemoryCircuitBreakerStorageAdapter } from "@daiso-tech/core/circuit-breaker/memory-circuit-breaker-storage-adapter";const circuitBreakerStorageAdapter = new MemoryCircuitBreakerStorageAdapter(); Copy
import { MemoryCircuitBreakerStorageAdapter } from "@daiso-tech/core/circuit-breaker/memory-circuit-breaker-storage-adapter";const circuitBreakerStorageAdapter = new MemoryCircuitBreakerStorageAdapter();
You can also provide an Map.
Map
import { MemoryCircuitBreakerStorageAdapter } from "@daiso-tech/core/circuit-breaker/memory-circuit-breaker-storage-adapter";const map = new Map<any, any>();const circuitBreakerStorageAdapter = new MemoryCircuitBreakerStorageAdapter(map); Copy
import { MemoryCircuitBreakerStorageAdapter } from "@daiso-tech/core/circuit-breaker/memory-circuit-breaker-storage-adapter";const map = new Map<any, any>();const circuitBreakerStorageAdapter = new MemoryCircuitBreakerStorageAdapter(map);
Removes all in-memory circuit breaker data.
Retrieves the current circuit breaker state for a given key.
The unique identifier for the cricuit breaker.
Returns the circuit breaker state if found, otherwise null.
null
Removes a circuit breaker from the database.
The unique identifier for the cricuit breaker to remove.
The transaction method runs the fn function inside a transaction. The fn function is given a ICircuitBreakerStorageAdapterTransaction object.
transaction
fn
ICircuitBreakerStorageAdapterTransaction
Note the
MemoryCircuitBreakerStorageAdapteris limited to single process usage and cannot be shared across multiple servers or different processes. This adapter is meant for testing.IMPORT_PATH:
"@daiso-tech/core/circuit-breaker/memory-circuit-breaker-storage-adapter"