SHARED_NATS_CLIENT

Static SHARED_NATS_CLIENT 

Source
pub static SHARED_NATS_CLIENT: LazyLock<Cache<NatsConnectionProps, Weak<Client>>>
Expand description

Shared NATS client cache. Client connections are cached as Weak pointers in the cache. NATS Connector can access this cache to reuse existing client connections, and avoid exhausting host machine ports. When reading from the cache, the connector should upgrade the weak pointer to an Arc reference. After all strong (Arc) references are dropped, the client connection will be cleaned up. Cache eviction naturally takes care of the dangling weak pointers.