|null Cached payload, or null on miss / expired. */ public function get( string $key ): ?array; /** * Write the search-result payload under `$key` with the given * TTL in seconds. * * Implementations MUST reject `$ttlSeconds <= 0` with * {@see \InvalidArgumentException}; a non-positive TTL has no * meaningful semantics for this layer (it would either store * an entry that is born expired or invite a "store forever" * misinterpretation that the spec deliberately does not grant). * * @param string $key Cache key. * @param array $payload Normalized search result. * @param int $ttlSeconds TTL in seconds; must be > 0. * * @throws InvalidArgumentException When `$ttlSeconds` is non-positive. */ public function put( string $key, array $payload, int $ttlSeconds ): void; /** * Remove the entry stored under `$key`. * * Idempotent: a call against an unknown key is a no-op. * * @param string $key Cache key. */ public function forget( string $key ): void; /** * Drop every entry stored in this cache layer. * * Scope is the layer instance, not the underlying store; if * an implementation shares storage with another layer, the * shared backend MUST still partition entries so flushing * one layer does not also drop a sibling layer's entries. */ public function flush(): void; }