Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • DataSourceBrowserDB

Index

Constructors

constructor

  • Parameters

    • dbName: any
    • storeName: any

    Returns DataSourceBrowserDB

Properties

Private db

db: Store

Private dbName

dbName: any

Private storeName

storeName: any

Static isIndexedDBAvailable

isIndexedDBAvailable: boolean = isNode? false: "indexedDB" in window

Methods

clear

  • clear(): Promise<void>
  • This method will clear the indexed DB store

    Returns Promise<void>

createIndexedDBStore

  • createIndexedDBStore(): void
  • this method will create Indexed DB with given namespace

    Returns void

delete

  • delete(key: any, cacheType?: any): Promise<void>
  • This method will delete the cache for given key

    Parameters

    • key: any

      the key using which data can be indexed

    • Optional cacheType: any

      is a optional parameter. It is the type of cache to be used. It will be of the type CacheType Enum. If not specified it will be indexed db

    Returns Promise<void>

deleteDatabase

  • deleteDatabase(): Promise<unknown>
  • Returns Promise<unknown>

get

  • this method will return cached response for given key

    Parameters

    • key: any

      the key where data is indexed

    • Optional cacheType: any

      is a optional parameter. It is the type of cache to be used. It will be of the type CacheType Enum. If not specified it will be indexed db

    Returns Promise<CacheResult>

getCacheableValue

  • getCacheableValue(cacheable: any, url: any): boolean
  • Parameters

    • cacheable: any
    • url: any

    Returns boolean

getCachedResults

  • getCachedResults(iDBKey: any): Promise<any>
  • getCachedResults will return the cached Api reponse for given Indexed DB key within cache duration

    Parameters

    • iDBKey: any

      the key used to get the cached data, if it is within cacheExpiration time

    Returns Promise<any>

getCachedResultsLocalStorage

  • getCachedResultsLocalStorage(Key: any): Promise<any>
  • getCachedResultsLocalStorage will return the cached Api reponse for given Local Storage key within cache duration

    Parameters

    • Key: any

      the key used to get the cached data, if it is within cacheExpiration time

    Returns Promise<any>

getCachedResultsSessionStorage

  • getCachedResultsSessionStorage(Key: any): Promise<any>
  • getCachedResultsSessiomStorage will return the cached Api reponse for given Session Storage key within cache duration

    Parameters

    • Key: any

      the key used to get the cached data, if it is within cacheExpiration time

    Returns Promise<any>

getDataFromCache

  • getDataFromCache(key: any, reload: any, cacheType?: any): Promise<any>
  • Method to fetch cache if reload is true

    Parameters

    • key: any

      is the Indexed DB key to cache data

    • reload: any

      value set to specify if data should be fetched from cache.

    • Optional cacheType: any

      is a optional parameter. It is the type of cache to be used. It will be of the type CacheType Enum. If not specified it will be indexed db

    Returns Promise<any>

keys

  • keys(): Promise<(string | number | Date | ArrayBufferView | ArrayBuffer | IDBArrayKey)[]>
  • This method will return all the keys for current Database and the store

    Returns Promise<(string | number | Date | ArrayBufferView | ArrayBuffer | IDBArrayKey)[]>

set

  • set(key: any, val: any, cacheType?: any): Promise<void>
  • This method will set the cache for given key

    Parameters

    • key: any

      the key where data should be indexed

    • val: any

      the value which should be stored in indexed DB

    • Optional cacheType: any

      is a optional parameter. It is the type of cache to be used. It will be of the type CacheType Enum. If not specified it will be indexed db

    Returns Promise<void>

setCache

  • setCache(key: any, result: any, cacheExpiration: any, cacheType?: any): Promise<void>
  • setCache sets the result to the cache

    Parameters

    • key: any

      is the key to cache data

    • result: any

      is the data which needs to be cached

    • cacheExpiration: any

      is the duration for which cache should be accessible

    • Optional cacheType: any

      is a optional parameter. It is the type of cache to be used. It will be of the type CacheType Enum. If not specified it will be indexed db

    Returns Promise<void>

setResultsCache

  • setResultsCache(iDBKey: any, result: any, cacheExpiration: any): Promise<void>
  • setResultsCache sets the result to the Indexed DB

    Parameters

    • iDBKey: any

      is the Indexed DB key to cache data

    • result: any

      is the data which needs to be cached

    • cacheExpiration: any

      is the duration for which cache should be accessible

    Returns Promise<void>

setResultsCacheLocalStorage

  • setResultsCacheLocalStorage(key: any, result: any, cacheExpiration: any): Promise<void>
  • setResultsCacheLocalStorage sets the result to the Local Storage

    Parameters

    • key: any

      is the Local Storage key to cache data

    • result: any

      is the data which needs to be cached

    • cacheExpiration: any

      is the duration for which cache should be accessible

    Returns Promise<void>

setResultsCacheSessionStorage

  • setResultsCacheSessionStorage(key: any, result: any, cacheExpiration: any): Promise<void>
  • setResultsCacheSessionStorage sets the result to the session Storage

    Parameters

    • key: any

      is the session Storage key to cache data

    • result: any

      is the data which needs to be cached

    • cacheExpiration: any

      is the duration for which cache should be accessible

    Returns Promise<void>

Generated using TypeDoc