{"id":16767517,"url":"https://github.com/purewhitewu/fastcache","last_synced_at":"2025-10-04T11:41:14.264Z","repository":{"id":188693853,"uuid":"679205558","full_name":"PureWhiteWu/fastcache","owner":"PureWhiteWu","description":"A performant but not-so-accurate time and capacity based cache for Rust.","archived":false,"fork":false,"pushed_at":"2024-12-04T12:37:59.000Z","size":21,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-03T06:52:40.118Z","etag":null,"topics":["cache","performant","rust","ttl-cache"],"latest_commit_sha":null,"homepage":"https://docs.rs/fastcache","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PureWhiteWu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2023-08-16T10:25:11.000Z","updated_at":"2024-12-04T12:38:03.000Z","dependencies_parsed_at":"2024-09-11T12:00:33.439Z","dependency_job_id":"ff74854d-30d8-4967-81d2-d4c7433cb182","html_url":"https://github.com/PureWhiteWu/fastcache","commit_stats":null,"previous_names":["purewhitewu/fastcache"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PureWhiteWu/fastcache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PureWhiteWu%2Ffastcache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PureWhiteWu%2Ffastcache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PureWhiteWu%2Ffastcache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PureWhiteWu%2Ffastcache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PureWhiteWu","download_url":"https://codeload.github.com/PureWhiteWu/fastcache/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PureWhiteWu%2Ffastcache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278308046,"owners_count":25965652,"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-04T02:00:05.491Z","response_time":63,"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","performant","rust","ttl-cache"],"created_at":"2024-10-13T06:09:19.193Z","updated_at":"2025-10-04T11:41:14.218Z","avatar_url":"https://github.com/PureWhiteWu.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fastcache\n\n[![Crates.io](https://img.shields.io/crates/v/fastcache)](https://crates.io/crates/fastcache)\n[![Documentation](https://docs.rs/fastcache/badge.svg)](https://docs.rs/fastcache)\n[![License](https://img.shields.io/crates/l/fastcache)](#license)\n[![Build Status][actions-badge]][actions-url]\n\n[actions-badge]: https://github.com/PureWhiteWu/fastcache/actions/workflows/rust.yml/badge.svg\n[actions-url]: https://github.com/PureWhiteWu/fastcache/actions/workflows/rust.yml\n\nA performant but not-so-accurate time and capacity based cache for Rust.\n\nThis crate provides an implementation of a time-to-live (TTL) and capacity based cache.\nIt stores key-value pairs and automatically evicts expired entries based on their TTL.\n\nThe design trades off exact TTL-based expiration for better performance,\nwhich means that expired items may not be removed immediately upon expiration,\nand an item may be removed before its expiration time.\n\nIt's also by design that `get` may return expired items, which means that the caller should\ncheck the expiration status of the returned value by calling `value.is_expired()`\nbefore using it. It's up to the user if to use the expired value or not.\n\nThis design can be useful in some cases, for example, when the caller wants to use the\nexpired value as a fallback or to do rpc in background to update the value and return\nthe expired value immediately to reduce latency.\n\n## Examples\n\n```rust\nuse fastcache::Cache;\nuse std::time::Duration;\n\nlet cache = Cache::new(3, Duration::from_secs(3600)); // Capacity: 3, TTL: 1 hour\ncache.insert(\"key1\", \"value1\");\ncache.insert(\"key2\", \"value2\");\n\nif let Some(value) = cache.get(\"key1\") {\n    println!(\"Value: {}\", value.get());\n} else {\n    println!(\"Value not found\");\n}\n```\n\n## License\n\n`fastcache` is dual-licensed under the MIT license and the Apache License (Version 2.0).\n\n## Contributing\n\nAny kinds of contributions are welcomed. Feel free to open pull requests or issues.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurewhitewu%2Ffastcache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpurewhitewu%2Ffastcache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurewhitewu%2Ffastcache/lists"}