{"id":13672443,"url":"https://github.com/selmeci/cascara","last_synced_at":"2025-10-10T00:38:54.982Z","repository":{"id":55585925,"uuid":"267353889","full_name":"selmeci/cascara","owner":"selmeci","description":"An implementation of TinyLFU cache","archived":false,"fork":false,"pushed_at":"2022-10-10T13:53:40.000Z","size":34,"stargazers_count":15,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-24T03:12:16.795Z","etag":null,"topics":["cache","lfu","lfu-cache","rust","tinylfu"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/selmeci.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-27T15:17:08.000Z","updated_at":"2024-07-09T18:00:00.000Z","dependencies_parsed_at":"2022-08-15T03:40:47.715Z","dependency_job_id":null,"html_url":"https://github.com/selmeci/cascara","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/selmeci/cascara","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selmeci%2Fcascara","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selmeci%2Fcascara/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selmeci%2Fcascara/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selmeci%2Fcascara/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/selmeci","download_url":"https://codeload.github.com/selmeci/cascara/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selmeci%2Fcascara/sbom","scorecard":{"id":810569,"data":{"date":"2025-08-11","repo":{"name":"github.com/selmeci/cascara","commit":"7e68968f9fa65ab6e8ed755f7e3d7d8ada304333"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Code-Review","score":0,"reason":"Found 1/14 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 4 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T13:04:15.619Z","repository_id":55585925,"created_at":"2025-08-23T13:04:15.620Z","updated_at":"2025-08-23T13:04:15.620Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002349,"owners_count":26083357,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cache","lfu","lfu-cache","rust","tinylfu"],"created_at":"2024-08-02T09:01:35.767Z","updated_at":"2025-10-10T00:38:54.949Z","avatar_url":"https://github.com/selmeci.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# An implementation of TinyLFU cache\n\n[![Build Status](https://travis-ci.org/selmeci/cascara.svg?branch=master)](https://travis-ci.org/selmeci/cascara)\n[![Latest Version](https://img.shields.io/crates/v/cascara.svg)](https://crates.io/crates/cascara)\n[![Docs](https://docs.rs/cascara/badge.svg)](https://docs.rs/cascara)\n[![Coverage Status](https://coveralls.io/repos/github/selmeci/cascara/badge.svg?branch=master)](https://coveralls.io/github/selmeci/cascara?branch=master)\n\n[TinyLFU](https://arxiv.org/abs/1512.00727) proposes to use a frequency based cache admission policy in order to boost the effectiveness of caches subject to skewed access distributions. Given a newly accessed item and an eviction candidate from the cache, TinyLFU scheme decides, based on the recent access history, whether it is worth admitting the new item into the cache at the expense of the eviction candidate. TinyLFU maintains an approximate representation of the access frequency of a large sample of recently accessed items. TinyLFU is very compact and light-weight as it builds upon Bloom filter theory.\n\nThis repository implements TinyLFU with help of [probabilistic_collections](https://crates.io/crates/probabilistic-collections) crate.\n\nCache provides: `insert`, `insert_with_ttl`, `get`, `get_mut`, `remove`, `contains`, `is_empty` operations.\n\n## Example\n\n```rust\nextern crate cascara;\n\nuse cascara::{Cache, OnEvict};\nuse std::time::Duration;\n\n#[derive(Default, Debug)]\nstruct Evict {}\n\nimpl OnEvict\u003cusize, usize\u003e for Evict {\n    fn evict(\u0026self, k: \u0026usize, v: \u0026usize) {\n        println!(\"Evict item.  k={}, v={}\", k, v);\n    }\n}\n\nfn main() {\n    //create cache with activated metrics collecting(mis, hit, insert, update, evict)\n    let mut cache = Cache::with_on_evict(10, 20, Evict::default())\n        .with_metrics();\n    assert!(cache.is_empty());\n    assert_eq!(cache.get(\u00261), None);\n    cache.insert(1, 1).expect(\"Item is not inserted\");\n    assert_eq!(cache.get(\u00261), Some(\u00261));\n    let previous = cache.insert(1, 2).expect(\"Item is not updated\");\n    assert_eq!(previous, Some(1));\n    assert_eq!(cache.get(\u00261), Some(\u00262));\n    cache\n        .insert_with_ttl(2, 2, Duration::from_secs(1))\n        .expect(\"Item is not inserted\");\n    assert!(cache.contains(\u00262));\n    std::thread::sleep(Duration::from_secs(2));\n    assert!(!cache.contains(\u00262));\n    {\n        let v = cache.get_mut(\u00261).unwrap();\n        *v = 3;\n    }\n    assert_eq!(cache.get(\u00261), Some(\u00263));\n    for i in 0..25 {\n        match cache.insert(i, i) {\n            Ok(_) =\u003e println!(\"Item is inserted. i: {}\", i),\n            Err(_) =\u003e println!(\"Item is rejected. i: {}\", i),\n        }\n    }\n    for (k, v) in cache.iter() {\n        println!(\"Item: k: {}, v: {}\", k, v);\n    }\n    println!(\n        \"\\nCache metrics. {:?}\",\n        cache.metrics().expect(\"Cache should have metrics\")\n    )\n}\n\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselmeci%2Fcascara","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fselmeci%2Fcascara","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselmeci%2Fcascara/lists"}