{
  "handle": "Cache",
  "mechanism": "A temporary keyed storage layer for keeping frequently accessed {{datum}} or {{state}} alongside the inputs that produced them, so repeat lookups bypass re-computation. Read-through, write-behind, and invalidation discipline are descendant concerns; the foundation is the keyed lookup that returns a stored value if present.",
  "gloss": "Keyed storage for reusing previously obtained values",
  "failure_modes": [
    "Staleness: Serving outdated data after the source has changed.",
    "Thrashing: Frequent evictions due to insufficient size."
  ],
  "invariants": [
    "Consistency: Cache(Key) == Source(Key) if valid.",
    "Freshness: Expired items must not be returned."
  ],
  "preconditions": [
    "Key is hashable",
    "Value is serializable"
  ],
  "postconditions": [
    "On a cache hit, the stored value for the requested key is returned without requiring recomputation."
  ],
  "sema_id": "sema:Cache#mh:SHA-256:465f391fb70426b0ec99c724ecf5db549d4f2e8124c821530271124aa10e17f3",
  "sema_ref": "Cache#465f",
  "sema_stub": "465f",
  "_meta": {
    "ring": 0,
    "tier": 1,
    "supersedes": [
      "sema:Cache#mh:SHA-256:1ea9ba40ef01b9f6072ae6bb93d37096c11655bb43a5bebe172d50365dde1073",
      "sema:Cache#mh:SHA-256:30c9445ad9acaafbda91309d2ac5da1b52aec6d5e7fee8c097fd666cb11cefa5",
      "sema:Cache#mh:SHA-256:55e2dfe59df3e261e74c0ecdafa7216cf6fea44e60692125499924c7a8104771"
    ],
    "path": [
      "Infrastructure",
      "Data Structures"
    ]
  },
  "data_schema": {
    "type": "object",
    "description": "Keyed-value storage with lookup semantics.",
    "properties": {
      "key": {
        "type": "string",
        "description": "Lookup key. Required: a keyed store with no key is not a cache."
      },
      "value": {
        "description": "Stored value returned on a hit."
      },
      "hit": {
        "type": "boolean",
        "description": "Whether the key was found on lookup"
      }
    },
    "required": [
      "key",
      "value"
    ]
  },
  "dependencies": {
    "references": {
      "datum": "sema:Datum#mh:SHA-256:f90456c1067ac5db4e9825a82a22bc58086022f8acd0d0f63fdfeaeb6be2e937",
      "state": "sema:State#mh:SHA-256:4f25e6a16ccd37dc0bc154cccc7055cb504d49daa8b712f372a425eb6c7b8cb2"
    }
  },
  "sema_layer": "Infrastructure",
  "sema_category": "Data Structures",
  "used_by": {
    "references": {
      "HeuristicSnap": "sema:HeuristicSnap#mh:SHA-256:d683f415a9eabd2639464e981993ed784e7f9aed6800f92abe66182df817696f",
      "IdempotentWrite": "sema:IdempotentWrite#mh:SHA-256:7226e14f5caed42394b33c28989972451a03b43ba531e8cb6a9975a0fee4ab2c",
      "PathwayMemory": "sema:PathwayMemory#mh:SHA-256:ce2e6ce822404fae0e60a43fc2c6fbe2e4d51ab9aefee1e7a9e21da75893e722"
    }
  }
}
