Options
All
  • Public
  • Public/Protected
  • All
Menu

An etcd v3 store adapter for Express session using etcd3 client.

var session = require('express-session');
var Etcd3Store = require('express-session-etcd3');

app.use(session({
    store: new Etcd3Store(options),
    secret: 'keyboard cat',
    resave: false
}));

Hierarchy

  • Store
    • Etcd3Store

Index

Constructors

constructor

Properties

Private client

client: Etcd3

Private config

createSession

createSession: function

Type declaration

    • (req: express.Request, sess: SessionData): void
    • Parameters

      • req: express.Request
      • sess: SessionData

      Returns void

Private debug

debug: IDebugger = debug('express-session:etcd3')

load

load: function

Type declaration

    • (sid: string, fn: function): void
    • Parameters

      • sid: string
      • fn: function
          • (err: any, session: Session): any
          • Parameters

            • err: any
            • session: Session

            Returns any

      Returns void

regenerate

regenerate: function

Type declaration

    • (req: express.Request, fn: function): void
    • Parameters

      • req: express.Request
      • fn: function
          • (err: any): any
          • Parameters

            • err: any

            Returns any

      Returns void

Static defaultMaxListeners

defaultMaxListeners: number

Methods

addListener

  • addListener(event: string | symbol, listener: function): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

all

  • all(callback: function): void
  • This method is used to get all sessions in the store as an array. The callback should be called as callback(error, sessions).

    Parameters

    • callback: function
        • (err: any, obj: object): void
        • Parameters

          • err: any
          • obj: object
            • [sid: string]: SessionData

          Returns void

    Returns void

Private callbackWithLog

  • callbackWithLog(cb: Function, err?: any, value?: any): void
  • Logging callback result

    Parameters

    • cb: Function
    • Default value err: any = null
    • Default value value: any = null

    Returns void

clear

  • clear(callback: function): void
  • This method is used to delete all sessions from the store. The callback should be called as callback(error) once the store is cleared.

    Parameters

    • callback: function
        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns void

destroy

  • destroy(sid: string, callback: function): void
  • This method is used to destroy/delete a session from the store given a session ID (sid). The callback should be called as callback(error) once the session is destroyed.

    Parameters

    • sid: string
    • callback: function
        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns void

emit

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

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

    Returns boolean

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

get

  • get(sid: string, callback: function): void
  • This method is used to get a session from the store given a session ID (sid). The callback should be called as callback(error, session).

    The session argument should be a session if found, otherwise null or undefined if the session was not found (and there was no error). A special case is made when error.code === 'ENOENT' to act like callback(null, null).

    Parameters

    • sid: string
    • callback: function
        • (err: any, session: SessionData): void
        • Parameters

          • err: any
          • session: SessionData

          Returns void

    Returns void

getMaxListeners

  • getMaxListeners(): number
  • Returns number

Private getRawTTL

  • getRawTTL(sess: SessionData, sid: string): number
  • Get the raw Time to Live (ttl) of the session from the data sources

    Parameters

    • sess: SessionData
    • sid: string

    Returns number

Private getTTL

  • getTTL(sess: SessionData, sid: string): number

Private key

  • key(sid?: string): string
  • Build the etcd key with the right prefix and the givin session ID (sid)

    Parameters

    • Default value sid: string = ""

    Returns string

length

  • length(callback: function): void
  • This method is used to get the count of all sessions in the store. The callback should be called as callback(error, len).

    Parameters

    • callback: function
        • (err: any, length: number): void
        • Parameters

          • err: any
          • length: number

          Returns void

    Returns void

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

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

    • event: string | symbol

    Returns Function[]

on

  • on(event: string | symbol, listener: function): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: function): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: function): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

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

    • event: string | symbol

    Returns Function[]

removeAllListeners

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

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: function): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

set

  • set(sid: string, session: SessionData, callback: function): void
  • This required method is used to upsert a session into the store given a session ID (sid) and session (session) object. The callback should be called as callback(error) once the session has been set in the store.

    Parameters

    • sid: string
    • session: SessionData
    • callback: function
        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns void

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

touch

  • touch(sid: string, session: SessionData, callback: function): void
  • This method is used to "touch" a given session given a session ID (sid) and session (session) object. The callback should be called as callback(error) once the session has been touched.

    This is primarily used when the store will automatically delete idle sessions and this method is used to signal to the store the given session is active, potentially resetting the idle timer.

    Parameters

    • sid: string
    • session: SessionData
    • callback: function
        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns void

Static listenerCount

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

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc