A bounded cache with LONG keys and LONG values. Least-recently-used entries are evicted when the capacity is exceeded.
A bounded cache with LONG keys and LONG values. Least-recently-used entries are evicted when the capacity is exceeded.
Kind: Container | Category: H-Lib Native Containers
PBXB64 Status: AVAILABLE
PBXB64 Certification: [CERTIFIED TESTED]
This H-Lib container is implemented in native C support code and exposed through PBXB64 BASIC container syntax. The examples below are focused usage patterns; keep handles valid, release each container with its Final method, and check counts or return values when a method can fail.
| Method | Signature | Returns | Description |
|---|---|---|---|
| New | c.New capacity | LNLRU | Allocate a cache with the given capacity. |
| Final | c.Final | none | Free the cache. |
| Validate | c.Validate | LONG | Non-zero if the handle is valid. |
| Clear | c.Clear | none | Remove all entries. |
| Count | c.Count | LONG | Number of entries currently stored. |
| Capacity | c.Capacity | LONG | Maximum number of entries allowed. |
| Trim | c.Trim | none | Gibt ungenutzten Speicher frei, ohne die konfigurierte Grenze zu ändern. |
| Clone | c.Clone | LNLRU | Gibt einen unabhängigen Cache mit derselben Zugriffsreihenfolge zurück. |
| Put | c.Put key, value | none | Insert or update a key and make it most-recently used. |
| Get | c.Get key | QUAD | Retrieve a value and make the key most-recently used (0 if missing). |
| Contains | c.Contains key | LONG | Non-zero if the key is in the cache. |
| Remove | c.Remove key | LONG | Entfernt einen Schlüssel und gibt ungleich Null zurück, wenn er vorhanden war. |
| Empty | c.Empty | LONG | Non-zero if the cache is empty. |
Validation evidence: H-Lib container behavior is exercised by registered BASIC container validation programs and the embedded H-Lib object set used by the single-EXE validation gate.
Diese Referenzseite soll durch ein fokussiertes Compile- oder Laufzeitbeispiel belegt sein. Das Beispiel soll Eingaben, erwartete Ausgabe oder Exit-Code und erforderliche Windows-Ressourcen oder Include-Dateien nennen.
Allgemeine Übersichtsseiten sollten trotzdem sagen, welche Familie gemeint ist, welche konkreten Befehlsseiten die Implementierung tragen und welche Formen nur der Navigation dienen. So bleibt die Seite detailliert genug, ohne so zu tun, als wäre sie eine vollständige Befehlsreferenz.
LOCAL c AS LNLRU c = c.New 2 c.Put 1, 10 c.Put 2, 20 c.Put 3, 30 ' evicts key 1 PRINT c.Contains 1 ' 0 c.Final