@nowarajs/kv-store
    Preparing search index...

    Class BunRedisStore

    Redis-based key-value store implementation using Bun's Redis client.

    Provides a Redis-backed implementation of the KvStore interface with automatic JSON serialization/deserialization and proper error handling.

    Implements

    Index

    Constructors

    Methods

    • Decrement the value associated with a key. Value needs to be a number.

      Parameters

      • key: string

        The key to decrement the value for.

      • Optionalamount: number

        The amount to decrement by.

      Returns Promise<number>

      The new value after decrementing.

    • Delete a key from the store.

      Parameters

      • key: string

        The key to delete.

      Returns Promise<boolean>

      true if the key was deleted, false otherwise.

    • Set the expiration time for a key.

      Parameters

      • key: string

        The key to set the expiration for.

      • ttlSec: number

        The time-to-live for the key, in seconds.

      Returns Promise<boolean>

      true if the expiration was set, false otherwise.

    • Get the value associated with a key.

      Type Parameters

      • T = unknown

        The type of the value to retrieve.

      Parameters

      • key: string

        The key to retrieve the value for.

      Returns Promise<T | null>

      The value associated with the key, or null if the key does not exist.

    • Increment the value associated with a key. Value needs to be a number.

      Parameters

      • key: string

        The key to increment the value for.

      • Optionalamount: number

        The amount to increment by.

      Returns Promise<number>

      The new value after incrementing.

    • Set the value associated with a key.

      Type Parameters

      • T = unknown

        The type of the value to set.

      Parameters

      • key: string

        The key to set the value for.

      • value: T

        The value to set.

      • OptionalttlSec: number

        The time-to-live for the key, in seconds.

      Returns Promise<void>

    • Get the remaining time-to-live for a key.

      Parameters

      • key: string

        The key to retrieve the TTL for.

      Returns Promise<number>

      The remaining time-to-live for the key, in seconds.