HTTP module

DateCache

Caches the formatted Date header, updated once per second.

DateCache

#include <icy/http/server.h>

Caches the formatted Date header, updated once per second. Avoids per-request time formatting and string allocation.

Public Attributes

ReturnNameDescription
charbuf
size_tlen
std::time_tlastSecond

buf

char buf {}

len

size_t len = 0

lastSecond

std::time_t lastSecond = 0

Public Methods

ReturnNameDescription
voidupdate inlineRefreshes the cached Date header string if the current second has changed. No-op if called multiple times within the same second.
const char *data const inlineReturns a pointer to the formatted "Date: ...\r\n" header string.
size_tsize const inlineReturns the byte length of the formatted Date header string.

update

inline

inline void update()

Refreshes the cached Date header string if the current second has changed. No-op if called multiple times within the same second.


data

const inline

inline const char * data() const

Returns a pointer to the formatted "Date: ...\r\n" header string.


size

const inline

inline size_t size() const

Returns the byte length of the formatted Date header string.