🚨 Announcing Vendure v2 Beta

InMemorySessionCacheStrategy

InMemorySessionCacheStrategy

Caches session in memory, using a LRU cache implementation. Not suitable for multi-server setups since the cache will be local to each instance, reducing its effectiveness. By default the cache has a size of 1000, meaning that after 1000 sessions have been cached, any new sessions will cause the least-recently-used session to be evicted (removed) from the cache.

The cache size can be configured by passing a different number to the constructor function.

Signature

class InMemorySessionCacheStrategy implements SessionCacheStrategy {
  constructor(cacheSize?: number)
  delete(sessionToken: string) => ;
  get(sessionToken: string) => ;
  set(session: CachedSession) => ;
  clear() => ;
}

Implements

Members

constructor

method
type:
(cacheSize?: number) => InMemorySessionCacheStrategy

delete

method
type:
(sessionToken: string) =>

get

method
type:
(sessionToken: string) =>

set

method
type:
(session: CachedSession) =>

clear

method
type:
() =>