Csilk 0.2.1
A lightweight, high-performance C HTTP web framework
Loading...
Searching...
No Matches
csilk_storage_driver_t Struct Reference

Pluggable storage driver for context key-value pairs. More...

#include <csilk.h>

Data Fields

void(* set )(csilk_ctx_t *c, const char *key, void *value)
 Store a value associated with key.
 
void *(* get )(csilk_ctx_t *c, const char *key)
 Retrieve a value by key.
 
void(* clear )(csilk_ctx_t *c)
 Clear all stored key-value pairs. Called during csilk_ctx_cleanup to release references.
 

Detailed Description

Pluggable storage driver for context key-value pairs.

Allows users to replace the default in-memory arena-backed store with a custom backend (e.g., a thread-local or external cache). Every function receives the owning csilk_ctx_t so drivers can access per-request state.

Note
All driver functions are called from the libuv event-loop thread; implementations need not be thread-safe.

Field Documentation

◆ clear

void(* csilk_storage_driver_t::clear)(csilk_ctx_t *c)

Clear all stored key-value pairs. Called during csilk_ctx_cleanup to release references.

◆ get

void *(* csilk_storage_driver_t::get)(csilk_ctx_t *c, const char *key)

Retrieve a value by key.

Parameters
cOwning request context.
keyNUL-terminated key string.
Returns
The stored pointer, or NULL if key was never set.

◆ set

void(* csilk_storage_driver_t::set)(csilk_ctx_t *c, const char *key, void *value)

Store a value associated with key.

Parameters
cOwning request context.
keyNUL-terminated key string (copied internally).
valueOpaque pointer to store. Ownership remains with caller.

The documentation for this struct was generated from the following files: