Skip to content
👁️

Hit Counter

A simple page visit counter. Each page load increments the count.

Uses our server

Updated

Total Page Hits

2

Each visit to this page increments the counter. Stored in cache for 24 hours.

One number, kept in the cache

Opening the page reads a single cache key. If the key is missing the counter is created with a value of 1 and an expiry of 86,400 seconds; otherwise it is raised by one and the new total is shown. The Refresh Count button posts to the same address and raises it again without reloading the page. The figure lives in the application cache rather than in a table of its own, and every visitor sees the same number.

A worked example

The first visit shows 1. Three presses of Refresh Count show 2, 3 and 4, so one person can move the number as fast as they can click. The 86,400-second expiry is written once, when the key first appears, and a later increment does not extend it: 24 hours after that first write the key is gone and the next visit starts again at 1. If the key disappears between the page load and a button press, there is nothing left to count and the field shows the word false until the page is reloaded.

Not an analytics package

There is one counter for the whole site rather than one per page, with no cookie, no session and no visitor identity, so a reload counts as a visit and so does a crawler. No history is kept either: the page shows a running total, not a rate, a trend or a referrer. Read it as a demonstration of a cached counter rather than as traffic data.

Where it stops

  • Clearing the cache, or a deploy that clears it, resets the total.
  • The 24-hour expiry is never extended, so the number cannot climb indefinitely.
  • No bot filtering, no uniqueness and no per-page breakdown.
  • Nothing is exported, graphed or timestamped.

Questions people ask

Why did the count go backwards?

The key expired. Expiry is fixed at the moment of creation, so the total restarts instead of continuing; routine cache maintenance has the same effect.

Can I put this counter on my own site?

The page counts its own address only. For real visitor numbers you need server logs or an analytics package; for a quick health check, use the website checker or the page snooper.