import { BaseCheck } from '@adonisjs/core/health'; import type { HealthCheckResult } from '@adonisjs/core/types/health'; import type { Connection } from '../types.ts'; /** * 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. * * @example * ```ts * const check = new RedisMemoryUsageCheck(redis.connection()) * .warnWhenExceeds('100mb') * .failWhenExceeds('200mb') * * const result = await check.run() * console.log(result.status) // 'ok', 'warning', or 'error' * ``` */ export declare class RedisMemoryUsageCheck extends BaseCheck { #private; /** * Health check public name */ name: string; /** * Create a new RedisMemoryUsageCheck instance * * @param connection - The Redis connection to monitor * * @example * ```ts * const check = new RedisMemoryUsageCheck(redis.connection('main')) * ``` */ constructor(connection: Connection); /** * Define the memory threshold after which a warning * should be created. * * @param value - Memory threshold as bytes or string (e.g. '200mb') * * @example * ```ts * check.warnWhenExceeds('200 mb') * check.warnWhenExceeds(209715200) // 200MB in bytes * ``` */ warnWhenExceeds(value: string | number): this; /** * Define the memory threshold after which an error * should be created. * * @param value - Memory threshold as bytes or string (e.g. '200mb') * * @example * ```ts * check.failWhenExceeds('500 mb') * check.failWhenExceeds(524288000) // 500MB in bytes * ``` */ failWhenExceeds(value: string | number): this; /** * Define a custom callback to compute Redis memory usage. The * return value must be a number in bytes or null. * * @param callback - Function that returns memory usage in bytes * * @example * ```ts * check.compute(async (connection) => { * const info = await connection.info('memory') * // Custom parsing logic * return memoryInBytes * }) * ``` */ compute(callback: (connection: Connection) => Promise): this; /** * Executes the health check * * @example * ```ts * const result = await check.run() * if (result.status === 'ok') { * console.log('Memory usage is within limits') * } * ``` */ run(): Promise; }