AdonisJS API
    Preparing search index...

    Class RedisMemoryUsageCheck

    The RedisMemoryUsageCheck can be used to monitor the memory consumption of a redis server and report a warning or error after a certain threshold has been execeeded.

    const check = new RedisMemoryUsageCheck(redis.connection())
    .warnWhenExceeds('100mb')
    .failWhenExceeds('200mb')

    const result = await check.run()
    console.log(result.status) // 'ok', 'warning', or 'error'

    Hierarchy

    • BaseCheck
      • RedisMemoryUsageCheck
    Index
    name: string

    Health check public name

    • Define a custom callback to compute Redis memory usage. The return value must be a number in bytes or null.

      Parameters

      • callback: (connection: Connection) => Promise<number | null>

        Function that returns memory usage in bytes

      Returns this

      check.compute(async (connection) => {
      const info = await connection.info('memory')
      // Custom parsing logic
      return memoryInBytes
      })
    • Executes the health check

      Returns Promise<HealthCheckResult>

      const result = await check.run()
      if (result.status === 'ok') {
      console.log('Memory usage is within limits')
      }