Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Session

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. MapLifecycleEvent.DESTROYED: when the underlying cache is destroyed
  2. MapLifecycleEvent.TRUNCATED: When the underlying cache is truncated
  3. MapLifecycleEvent.RELEASED: When the underlying cache is released

Hierarchy

  • EventEmitter
    • Session

Index

Constructors

constructor

Properties

Static Readonly DEFAULT_ADDRESS

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

The default target address to connect to Coherence gRPC server.

Static Readonly DEFAULT_FORMAT

DEFAULT_FORMAT: "json" = "json"

The default serialization format: 'json'

Static Readonly DEFAULT_REQUEST_TIMEOUT

DEFAULT_REQUEST_TIMEOUT: 60000 = 60000

The default request timeout.

Static defaultMaxListeners

defaultMaxListeners: number

Accessors

activeCacheCount

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

    Returns number

    the number of active caches created by this session

activeCacheNames

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

    Returns Set<string>

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

activeCaches

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

    Returns Array<NamedCacheClient>

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

address

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

    Returns string

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

channel

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

    Returns Channel

    the underlying gRPC Channel used by this session

channelCredentials

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

    Returns ChannelCredentials

    the gRPC ChannelCredentials used by this session

closed

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

    Returns boolean

    true if the session is closed

options

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

    Returns Options

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

Methods

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

callOptions

  • callOptions(): CallOptions
  • This is a shortcut to invoke the options callOptions function.

    Returns CallOptions

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

close

  • close(): Promise<void>
  • Close the Session.

    Returns Promise<void>

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): Array<string | symbol>

getCache

  • getCache<K, V>(name: string, format?: string): NamedCache<K, V>
  • Returns a NamedCacheClient for the specified cache name. This class maintains an internal cache (a Map) and if a NamedCacheClient exists in the cache it is returned. Else a new NamedCacheClient is created (then cached) and returned.

    Type parameters

    • K

    • V

    Parameters

    • name: string

      the cache name

    • Default value format: string = Session.DEFAULT_FORMAT

      the serialization format for keys and values stored within the cache

    Returns NamedCache<K, V>

getMap

  • getMap<K, V>(name: string, format?: string): NamedMap<K, V>
  • Type parameters

    • K

    • V

    Parameters

    • name: string
    • Default value format: string = Session.DEFAULT_FORMAT

    Returns NamedMap<K, V>

getMaxListeners

  • getMaxListeners(): number

listenerCount

  • listenerCount(type: string | symbol): number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

off

  • off(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

  • rawListeners(event: string | symbol): Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): this

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

setMaxListeners

  • setMaxListeners(n: number): this

waitUntilClosed

  • waitUntilClosed(): Promise<boolean>
  • Returns a promise that will resolve to true once the session has been closed.

    Returns Promise<boolean>

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

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number