Home
HTTP module

DateCache

Caches the formatted Date header, updated once per second.

DateCache

#include <icy/http/server.h>
struct DateCache

Defined in src/http/include/icy/http/server.h:228

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

List of all members

NameKindOwner
bufvariableDeclared here
lenvariableDeclared here
lastSecondvariableDeclared here
updatefunctionDeclared here
datafunctionDeclared here
sizefunctionDeclared here

Public Attributes

ReturnNameDescription
charbuf
size_tlen
std::time_tlastSecond

buf

char buf {}

Defined in src/http/include/icy/http/server.h:230


len

size_t len = 0

Defined in src/http/include/icy/http/server.h:231


lastSecond

std::time_t lastSecond = 0

Defined in src/http/include/icy/http/server.h:232

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()

Defined in src/http/include/icy/http/server.h:236

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

Defined in src/http/include/icy/http/server.h:253

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


size

const inline

inline size_t size() const

Defined in src/http/include/icy/http/server.h:256

Returns the byte length of the formatted Date header string.