{"id":18016902,"url":"https://github.com/fitzgen/associative-cache","last_synced_at":"2025-04-13T00:44:24.148Z","repository":{"id":35121720,"uuid":"209415479","full_name":"fitzgen/associative-cache","owner":"fitzgen","description":"A generic, fixed-size, associative cache","archived":false,"fork":false,"pushed_at":"2024-11-08T18:35:57.000Z","size":68,"stargazers_count":40,"open_issues_count":6,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-04T03:13:21.527Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.rs/associative-cache","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fitzgen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-18T22:35:57.000Z","updated_at":"2025-03-15T07:15:45.000Z","dependencies_parsed_at":"2024-06-21T14:19:31.015Z","dependency_job_id":"0b56ac54-55c0-41a5-bea0-2aa430bca059","html_url":"https://github.com/fitzgen/associative-cache","commit_stats":{"total_commits":11,"total_committers":3,"mean_commits":"3.6666666666666665","dds":"0.18181818181818177","last_synced_commit":"019ea6dc894017df0559b1f132bdaaf573f50e97"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fitzgen%2Fassociative-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fitzgen%2Fassociative-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fitzgen%2Fassociative-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fitzgen%2Fassociative-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fitzgen","download_url":"https://codeload.github.com/fitzgen/associative-cache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650419,"owners_count":21139672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-30T04:19:38.840Z","updated_at":"2025-04-13T00:44:24.122Z","avatar_url":"https://github.com/fitzgen.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `associative_cache`\n\n**A generic, fixed-size, associative cache data structure mapping `K` keys to\n`V` values.**\n\n[![](https://docs.rs/associative-cache/badge.svg)](https://docs.rs/associative-cache/)\n[![](https://img.shields.io/crates/v/associative-cache.svg)](https://crates.io/crates/associative-cache)\n[![](https://img.shields.io/crates/d/associative-cache.svg)](https://crates.io/crates/associative-cache)\n[![](https://github.com/fitzgen/associative-cache/actions/workflows/rust.yml/badge.svg)](https://github.com/fitzgen/associative-cache/actions/workflows/rust.yml)\n\n## Capacity\n\nThe cache has a constant, fixed-size capacity which is controlled by the `C`\ntype parameter and the `Capacity` trait. The memory for the cache entries is\neagerly allocated once and never resized.\n\n## Associativity\n\nThe cache can be configured as direct-mapped, two-way associative, four-way\nassociative, etc... via the `I` type parameter and `Indices` trait.\n\n## Replacement Policy\n\nThe cache can be configured to replace the least recently used (LRU) entry, or a\nrandom entry via the `R` type parameter and the `Replacement` trait.\n\n## Examples\n\n```rust\nuse associative_cache::*;\n\n// A two-way associative cache with random replacement mapping\n// `String`s to `usize`s.\nlet cache = AssociativeCache::\u003c\n    String,\n    usize,\n    Capacity512,\n    HashTwoWay,\n    RandomReplacement\n\u003e::default();\n\n// A four-way associative cache with random replacement mapping\n// `*mut usize`s to `Vec\u003cu8\u003e`s.\nlet cache = AssociativeCache::\u003c\n    *mut usize,\n    Vec\u003cu8\u003e,\n    Capacity32,\n    PointerFourWay,\n    RandomReplacement\n\u003e::default();\n\n// An eight-way associative, least recently used (LRU) cache mapping\n// `std::path::PathBuf`s to `std::fs::File`s.\nlet cache = AssociativeCache::\u003c\n    std::path::PathBuf,\n    WithLruTimestamp\u003cstd::fs::File\u003e,\n    Capacity128,\n    HashEightWay,\n    LruReplacement,\n\u003e::default();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffitzgen%2Fassociative-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffitzgen%2Fassociative-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffitzgen%2Fassociative-cache/lists"}