ladybird/Libraries/LibHTTP/Cache/CacheRequest.h
Timothy Flynn 21bbbacd07 LibHTTP+RequestServer: Move the HTTP cache implementation to LibHTTP
We currently have two ongoing implementations of RFC 9111, HTTP caching.
In order to consolidate these, this patch moves the implementation from
RequestServer to LibHTTP for re-use within LibWeb.
2025-11-29 08:35:02 -05:00

35 lines
718 B
C++

/*
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Badge.h>
#include <AK/Optional.h>
#include <AK/Weakable.h>
#include <LibHTTP/Forward.h>
namespace HTTP {
class CacheRequest : public Weakable<CacheRequest> {
public:
virtual ~CacheRequest() = default;
virtual void notify_request_unblocked(Badge<DiskCache>) = 0;
protected:
enum class CacheStatus : u8 {
Unknown,
NotCached,
WrittenToCache,
ReadFromCache,
};
Optional<CacheEntryReader&> m_cache_entry_reader;
Optional<CacheEntryWriter&> m_cache_entry_writer;
CacheStatus m_cache_status { CacheStatus::Unknown };
};
}