0.10.3 • Published 11 months ago

@blackglory/cache-js v0.10.3

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

cache-js

Install

npm install --save @blackglory/cache-js
# or
yarn add @blackglory/cache-js

API

CacheClient

interface ICacheClientOptions {
  server: string
  timeout?: number
  retryIntervalForReconnection?: number
}

interface INamespaceStats {
  items: number
}

interface IItem {
  value: JSONValue
  metadata: IItemMetadata
}

interface IItemMetadata {
  updatedAt: number
  timeToLive: number | null
}

class CacheClient {
  static create(options: ICacheClientOptions): Promise<CacheClient>

  close(): Promise<void>

  getNamespaceStats(namespace: string, timeout?: number): Promise<INamespaceStats>

  getAllNamespaces(timeout?: number): Promise<string[]>

  getAllItemKeys(namespace: string, timeout?: number): Promise<string[]>

  hasItem(namespace: string, itemKey: string, timeout?: number): Promise<boolean>

  getItem(
    namespace: string
  , itemKey: string
  , timeout?: number
  ): Promise<IItem | null>

  getItemValue(
    namespace: string
  , itemKey: string
  , timeout?: number
  ): Promise<JSONValue | null>

  getItemValues(
    namespace: string
  , itemKeys: string[]
  , timeout?: number
  ): Promise<Array<JSONValue | null>>

  setItem(
    namespace: string
  , itemKey: string
  , itemValue: JSONValue
  , timeToLive: number | null
  , timeout?: number
  ): Promise<void>

  removeItem(namespace: string, itemKey: string, timeout?: number): Promise<void>

  clearItemsByNamespace(namespace: string, timeout?: number): Promise<void>
}
0.10.3

11 months ago

0.10.0

1 year ago

0.10.1

1 year ago

0.10.2

1 year ago

0.9.0

1 year ago

0.8.1

1 year ago

0.8.0

1 year ago

0.9.2

1 year ago

0.9.1

1 year ago

0.5.0

1 year ago

0.7.0

1 year ago

0.6.0

1 year ago

0.4.2

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago