{
  "slug": "segmented-lru",
  "term": "Segmented LRU",
  "aliases": [
    "SLRU",
    "segmented least recently used"
  ],
  "definition": "Segmented LRU separates probationary and protected residents, promoting a probationary hit and demoting the least-recently-used protected entry when its limit is exceeded.",
  "note": "New entries join probation. A resident probation hit promotes the entry to protected MRU; a protected hit refreshes its order. Overflow demotes the protected LRU entry to probation rather than immediately discarding its payload. The probation LRU supplies eviction victims. [tinylfu]\n\nCapacity rules matter: the 2015 description uses fixed-size segments. The pinned simulator instead allows probation to occupy unused protected capacity and evicts only above the total limit. Three slots with a protected limit of two can therefore retain A, B and C during cold fill. [tinylfu] [code]\n\nIn a constructed A B C A trace, that shared-capacity rule gives one hit; reserving two initially empty protected slots gives zero. Both variants use the same total ceiling. The example isolates capacity semantics, not workload performance. [example]\n\nFull 2Q does not promote a resident A1in hit and keeps nonresident history. Plain SLRU needs no such history. TinyLFU is a separate admission decision; Window TinyLFU combines an admission window with an SLRU main cache. [twoq] [tinylfu]",
  "status": "research",
  "advantages": [],
  "limitations": [
    {
      "text": "A protected entry can later be demoted and evicted; protection is neither pinning nor a guarantee of future hits.",
      "citationIds": [
        "tinylfu"
      ]
    },
    {
      "text": "A segment fraction is a policy parameter, not a universal optimum. Compare payload, metadata, admission and cold-start rules together.",
      "citationIds": [
        "tinylfu",
        "code"
      ]
    }
  ],
  "related": [
    "lru-replacement",
    "two-queue-replacement",
    "tinylfu"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-18",
  "citations": [
    {
      "id": "tinylfu",
      "title": "Einziger, Friedman and Manes. TinyLFU: A Highly Efficient Cache Admission Policy. arXiv:1512.00727v2, sections 2.1 and 4.",
      "url": "https://arxiv.org/pdf/1512.00727v2",
      "accessed": "2026-11-18"
    },
    {
      "id": "code",
      "title": "Caffeine authors. SegmentedLruPolicy.java, commit 5227a98b51e02b4d4fbfc2b0e33c362a138f51b1, record/onHit/onMiss/evict.",
      "url": "https://github.com/ben-manes/caffeine/blob/5227a98b51e02b4d4fbfc2b0e33c362a138f51b1/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/SegmentedLruPolicy.java",
      "accessed": "2026-11-18"
    },
    {
      "id": "twoq",
      "title": "Johnson and Shasha. 2Q: A Low Overhead High Performance Buffer Management Replacement Algorithm. VLDB 1994, section 2.",
      "url": "https://www.vldb.org/conf/1994/P439.PDF",
      "accessed": "2026-11-18"
    },
    {
      "id": "example",
      "title": "Hesela. Segmented LRU: capacity rules, hand-traced states and executable tests.",
      "url": "https://hesela.dev/research/segmented-lru/README.md",
      "accessed": "2026-11-18"
    }
  ],
  "provenance": [
    "Primary-source synthesis and a constructed sequential state-machine demonstration. The example is not a native Caffeine execution or a reproduction of published benchmarks.",
    "The pinned simulator comparison assumes positive protected capacity and always-admit behavior. Production caches can add weights, expiry, asynchronous maintenance and admission filters.",
    "The original 1994 SLRU article was not read in full; no invention date or first-publication claim is inferred from later citations."
  ]
}
