Type Alias ICacheAdapter<TType>

ICacheAdapter<TType>: {
    add(key: string, value: TType, ttl: null | TimeSpan): PromiseLike<boolean>;
    clear(): PromiseLike<void>;
    get(key: string): PromiseLike<null | TType>;
    getGroup(): string;
    increment(key: string, value: number): PromiseLike<boolean>;
    put(key: string, value: TType, ttl: null | TimeSpan): PromiseLike<boolean>;
    remove(key: string): PromiseLike<boolean>;
    update(key: string, value: TType): PromiseLike<boolean>;
    withGroup(group: string): ICacheAdapter<TType>;
}

The ICacheAdapter contract defines a way for storing data as key-value pairs independent of data storage. This contract is not meant to be used directly, instead you should use ICache contract.

IMPORT_PATH: "@daiso-tech/core/cache/contracts"

Type Parameters

  • TType = unknown

Type declaration

  • add:function
    • The add method add a new key. Returns true if the key where added otherwise false will be returned. You must provide a ttl value. If null is passed, the item will not expire.

      Parameters

      Returns PromiseLike<boolean>

  • clear:function
  • get:function
  • getGroup:function
  • increment:function
    • The increment method will increment the given key if found otherwise nonthing will occur. Returns true if key is incremented otherwise false will be returned. An error will thrown if the key is not a number.

      Parameters

      • key: string
      • value: number

      Returns PromiseLike<boolean>

  • put:function
    • The put method replaces a key if the key exists including the ttl value or adds key that do not exists with a given ttl. Returns true if the key where replaced otherwise false is returned. You must provide a ttl value. If null is passed, the item will not expire.

      Parameters

      Returns PromiseLike<boolean>

  • remove:function
  • update:function
    • The update method updates a key. Returns true if the key where updated otherwise false will be returned.

      Parameters

      Returns PromiseLike<boolean>

  • withGroup:function