Session represents a logical connection to an endpoint. It also acts as a factory for creating caches.

This class also extends EventEmitter and emits the following events:

  1. DESTROYED: when the underlying cache is destroyed
  2. TRUNCATED: When the underlying cache is truncated
  3. RELEASED: When the underlying cache is released
  4. CONNECTED: when the Session detects the underlying gRPC` channel has connected.
  5. {@link event.SessionLifecycleEvent.DISCONNECTED}: when the Session detects the underlying gRPC` channel has disconnected
  6. RECONNECTED: when the Session detects the underlying gRPC` channel has re-connected
  7. {@link event.SessionLifecycleEvent.CLOSED}`: when the Session has been closed

Hierarchy

  • EventEmitter
    • Session

Constructors

  • Construct a new Session based on the provided Options.

    Parameters

    Returns Session

Properties

DEFAULT_ADDRESS: "localhost:1408" = 'localhost:1408'

The default target address to connect to Coherence gRPC server.

DEFAULT_FORMAT: "json" = 'json'

The default serialization format: 'json'

DEFAULT_READY_TIMEOUT: 30000 = 30000

The default gRPC stream ready timeout.

DEFAULT_REQUEST_TIMEOUT: 60000 = 60000

The default request timeout.

DEFAULT_SCOPE: "" = ''

The default scope.

Accessors

  • get activeCacheCount(): number
  • Return the number of active caches created by this session.

    Returns

    the number of active caches created by this session

    Returns number

  • get activeCacheNames(): Set<string>
  • Return a set of cache names for those caches that are currently active.

    Returns

    a set of cache names for those caches that are currently active

    Returns Set<string>

  • get activeCaches(): NamedCacheClient<any, any>[]
  • Returns an array of cache names for those caches that are currently active.

    Returns

    an array of cache names for those caches that are currently active

    Returns NamedCacheClient<any, any>[]

  • get address(): string
  • This is an alias for Session.options.address.

    Returns

    the IPv4 host address and port in the format of [host]:[port]

    Returns string

  • get channel(): ChannelImplementation
  • Return the underlying gRPC Channel used by this session.

    Returns

    the underlying gRPC Channel used by this session

    Returns ChannelImplementation

  • get channelCredentials(): ChannelCredentials
  • Return the gRPC ChannelCredentials used by this session.

    Returns

    the gRPC ChannelCredentials used by this session

    Returns ChannelCredentials

  • get clientOptions(): object
  • Internal

    Return the client options used to configure this session.

    Returns

    the client options used to configure this session

    Returns object

  • get closed(): boolean
  • Returns true if the session is closed.

    Returns

    true if the session is closed

    Returns boolean

  • get options(): Options
  • Return the Options (read-only) used to configure this session.

    Returns

    the Options (read-only) used to configure this session

    Returns Options

  • get scope(): string
  • Return the scope name used to link this Session with to the corresponding ConfigurableCacheFactory on the server.

    Returns

    return the scope name used to link this Session with to the corresponding ConfigurableCacheFactory on the server.

    Returns string

Methods

  • This is a shortcut to invoke the options callOptions function.

    Returns

    the gRPC CallOptions that will be applied to each request made using this session

    Returns CallOptions

  • Close the Session.

    Returns Promise<void>

  • Returns a NamedCache for the specified cache name.

    Type Parameters

    • K

    • V

    Parameters

    • name: string

      the cache name

    • format: string = Session.DEFAULT_FORMAT

      the serialization format for keys and values stored within the cache

    Returns NamedCache<K, V>

  • Returns a NamedMap for the specified map name.

    Type Parameters

    • K

    • V

    Parameters

    • name: string

      the cache name

    • format: string = Session.DEFAULT_FORMAT

      the serialization format for keys and values stored within the cache

    Returns NamedMap<K, V>

  • Returns a promise that will resolve to true once the session has been closed.

    Returns

    a promise that will resolve to true once the session has been closed

    Returns Promise<boolean>