{
  "slug": "cache-cost-class",
  "term": "Cache cost class",
  "aliases": [
    "Shared cache miss-cost class"
  ],
  "definition": "A cache cost class groups objects that share an estimate of the cost of fetching or recomputing a missing value.",
  "note": "Cost-aware hyperbolic caching multiplies access frequency by estimated miss cost. A shared class estimate can change the priority of resident members without fetching each one again. Objects reference the class and use its current estimate when evaluated. [paper]\n\nPer-object measurements can favor an accidentally slow fill; retaining that object then limits opportunities to remeasure it. Pooling comparable fills can reduce noise, but grouping unrelated costs can mislead the policy. [paper]\n\nConstructed example: equal-size residents A and B have frequencies 2 and 1 accesses/s and class costs 8 and 20 ms/fill, giving scores 16 and 20 ms/s. Updating A's class with a 32 ms fill and new-sample weight 1/4 gives 14 ms/fill and score 28 ms/s. The lower-score candidate changes from A to B without either resident being accessed. The score is an estimate, not measured saved time. [example]\n\nOn Unix, the pinned prototype combines recorded SQL durations with process CPU time for its cost signal; it separately records wall-clock elapsed time. Its adapter converts the former to an integer after multiplying by 100 and sends a class identifier based on the resolved URL name. These signals are not interchangeable latency measurements. [middleware] [adapter] [clock]",
  "status": "research",
  "advantages": [],
  "limitations": [
    {
      "text": "In the paper's Django-Wiki experiment, class-aware caching improved on per-object cost estimates but still underperformed cost-oblivious hyperbolic caching. Cost awareness is workload-dependent.",
      "citationIds": [
        "paper"
      ]
    }
  ],
  "related": [
    "hyperbolic-caching",
    "latency-storage"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-19",
  "citations": [
    {
      "id": "paper",
      "title": "Blankstein, Sen and Freedman. Hyperbolic Caching. USENIX ATC 2017, pp. 499-511, sections 3.1-3.2 and 5.1.4, Figure 7.",
      "url": "https://www.usenix.org/system/files/conference/atc17/atc17-blankstein.pdf",
      "accessed": "2026-11-19"
    },
    {
      "id": "middleware",
      "title": "Author prototype: timing boundaries and get_url_name; commit 884c466c311bb5b9fbdd09791d829b04032f3947.",
      "url": "https://github.com/kantai/hyperbolic-caching/blob/884c466c311bb5b9fbdd09791d829b04032f3947/django-middleware/hyperbolic_middleware.py",
      "accessed": "2026-11-19"
    },
    {
      "id": "adapter",
      "title": "Author prototype: HyperbolicCache.set cost conversion and class mapping; same pinned commit.",
      "url": "https://github.com/kantai/hyperbolic-caching/blob/884c466c311bb5b9fbdd09791d829b04032f3947/django-middleware/hyperbolic_cache.py",
      "accessed": "2026-11-19"
    },
    {
      "id": "clock",
      "title": "CPython 2.7.13 documentation: time.clock has processor-time semantics on Unix and elapsed wall-time semantics on Windows.",
      "url": "https://github.com/python/cpython/blob/v2.7.13/Doc/library/time.rst#L126-L140",
      "accessed": "2026-11-19"
    },
    {
      "id": "example",
      "title": "Hesela: exact shared-cost priority calculation, units, assumptions and executable model.",
      "url": "https://hesela.dev/research/cache-cost-class/results.json",
      "accessed": "2026-11-19"
    },
    {
      "id": "code",
      "title": "Hesela: standalone exact-rational calculation and input checks.",
      "url": "https://hesela.dev/research/cache-cost-class/model.py",
      "accessed": "2026-11-19"
    }
  ],
  "provenance": [
    "Primary-paper and pinned-code review, plus constructed exact arithmetic. No legacy middleware execution or reproduction of application throughput.",
    "The illustrative smoothing weight is chosen for explanation, not extracted from the prototype. Frequency, object size and resident identity are held fixed while the class estimate changes."
  ]
}
