This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
tango-tfe/plugin/business/pangu-http/pangu_web_cache.h
2018-10-14 18:45:02 +08:00

40 lines
1.3 KiB
C

#pragma once
#include <event2/event.h>
#include <event2/buffer.h>
#include <tfe_future.h>
enum cache_query_status
{
WEB_CACHE_BEFORE_QUERY=0,
WEB_CACHE_NOT_APPLICABLE,
WEB_CACHE_QUERING,
WEB_CACHE_NOT_HIT,
WEB_CACHE_HIT
};
struct cache_handle;
struct cache_handle* create_web_cache_handle(const char* profile_path, const char* section, void *logger);
struct cached_meta
{
char* content_length;
char* content_type;
};
struct cached_meta* cache_query_result_get_header(future_result_t * result);
void cache_query_free_meta(struct cached_meta* meta);
void cache_query_result_append_data(struct evbuffer* buf, future_result_t * result);
enum cache_query_status async_web_cache_query(struct cache_handle* handle, unsigned int thread_id,
const struct tfe_http_half * request, struct future* f);
int cache_query_result_is_header(future_result_t * result);
int cache_query_result_is_body(future_result_t * result);
struct cache_update_context;
struct cache_update_context* web_cache_update_start(struct cache_handle* handle, unsigned int thread_id,
const struct tfe_http_session * session);
void web_cache_update(struct cache_update_context* ctx, const unsigned char * body_frag, size_t frag_size);
void web_cache_update_end(struct cache_update_context* ctx);