Complete example
This example creates a simple HTTP server that displays system information. It’s based on theglaze_http example from the repository.
Key concepts
Cache manager
TheCacheManager is used to cache system information for better performance. Many system queries are expensive, so caching helps avoid redundant calls:
Result type
All system information functions return aResult<T> type, which is similar to Rust’s Result. This allows for safe error handling:
Resource usage
TheResourceUsage struct contains information about used and total bytes for memory and disk:
BytesToGiB() helper function to convert bytes to gibibytes for display.