var visit_count: usize = 0;
pub fn Page(ctx: zx.PageContext) zx.Component {
    const allocator = ctx.arena;

    if (visit_count == 3) {
        visit_count = 0;
        _ = zx.cache.delPrefix("cmp:time");
    } else {
        visit_count += 1;
    }

    return (
        <div @allocator={allocator}>
            <h1>Time: {visit_count}</h1> 
            <Time @caching="3s:time" />
        </div>
    );
}

fn Time(allocator: zx.Allocator) zx.Component {
    const time = std.time.timestamp();

    return (
        <p @allocator={allocator}>
            {time}
        </p>
    );
}

pub const options = zx.PageOptions{
    .rendering = .server,
    .caching = .{ .seconds = 1 },
};

const zx = @import("zx");
const std = @import("std");
