@aracna/core - v1.5.0
    Preparing search index...

    Class SyncStorage

    The SyncStorage class is an abstraction to implement any synchronous storage API in an uniform way.

    Aracna Reference

    Hierarchy

    • Storage
      • SyncStorage
    Index

    Constructors

    • Parameters

      • name: string
      • clear: () => void
      • get: <T extends StorageItem>(key: string) => T
      • has: (key: string) => boolean
      • remove: (key: string) => void
      • set: <T extends StorageItem>(key: string, item: T) => void

      Returns SyncStorage

    Properties

    _clear: Clear
    _get: Get
    _has: Has
    _remove: Remove
    _set: Set
    name: string

    The storage instance name.

    Methods

    • Parameters

      • cleared: void | Error

      Returns void | Error

    • Returns the name of the instance.

      Returns string

    • Checks if an item exists in the storage. Optionally you can specify the keys of the item that you want to check, if you don't specify any key the whole item will be checked.

      Type Parameters

      Parameters

      • key: string
      • Optionalkeys: (keyof T)[]

      Returns boolean

    • Type Parameters

      Parameters

      • keys: (keyof T)[] | undefined
      • item: Error | T

      Returns boolean

    • Removes an item from the storage. Optionally you can specify the keys of the item that you want to remove, if you don't specify any key the whole item will be removed.

      Type Parameters

      Parameters

      • key: string
      • Optionalkeys: (keyof T)[]

      Returns void | Error

    • Parameters

      • key: string
      • removed: void | Error

      Returns void | Error

    • Type Parameters

      Parameters

      • key: string
      • keys: (keyof T)[]
      • item: Error | T

      Returns T | undefined

    • Type Parameters

      Parameters

      • key: string
      • item: T
      • set: void | Error

      Returns void | Error

    • Sets an item in the storage. Optionally you can specify the keys of the item that you want to set, if you don't specify any key the whole item will be set.

      Type Parameters

      Parameters

      • key: string
      • item: T
      • Optionalkeys: (keyof T)[]

      Returns void | Error

    • Type Parameters

      Parameters

      • key: string
      • item: Error | T
      • set: void | Error

      Returns void | Error