import { RuleHandler } from "./_chunks/types.mjs"; import { CachedEventHandlerOptions, StorageInterface } from "ocache"; /** * Options for the ocache-backed {@link createOcacheRuleHandler}. All fields * are optional; the default uses ocache's in-memory storage out of the box. */ interface OcacheRuleHandlerOptions { /** ocache storage implementation (minimal `get`/`set`). Applied via `setStorage`. */ storage?: StorageInterface; /** * Default ocache options merged into every cache rule (rule options win). * Fully typed against ocache — implementation hooks (`getKey`, `shouldCache`, * `getMaxAge`, …) that the declarative rule schema excludes go here. */ defaults?: CachedEventHandlerOptions; } /** * Create an ocache-backed `cache` rule handler: ocache wired with h3's * `toResponse` / `handleCacheHeaders` so h3 handler return values (objects, * streams, …) serialize with full fidelity. No srvx / unstorage dependency — * global `Response` and ocache's in-memory storage by default. * * Memoization of wrapped handlers is instance-scoped (see the core * `createCacheRuleHandler` in `h3-rules`) — create one handler per matcher. * * Note: ocache storage is process-global — `storage` mutates it via * `setStorage`, affecting every ocache consumer in the process. */ declare function createOcacheRuleHandler(opts?: OcacheRuleHandlerOptions): RuleHandler<"cache">; /** * Shared default ocache-backed `cache` rule handler — the named export * compiled matchers import (`import { cache } from "h3-rules/cache"`, the * `DEFAULT_RUNTIME_RULES` source for `cache`), so its memoization is * module-scoped. Runtime matchers register it explicitly * (`handlers: { cache }`); for custom wiring point `runtimeRules` * (`{ cache: "#your/cache" }`) / `handlers` at your own instance instead. */ declare const cache: RuleHandler<"cache">; export { OcacheRuleHandlerOptions, cache, createOcacheRuleHandler };