{"id":18456420,"url":"https://github.com/pollen-robotics/cache_cache","last_synced_at":"2025-04-22T19:27:08.518Z","repository":{"id":83155645,"uuid":"585480385","full_name":"pollen-robotics/cache_cache","owner":"pollen-robotics","description":"Cache for controlling and reducing IO calls","archived":false,"fork":false,"pushed_at":"2023-08-22T14:00:59.000Z","size":30,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-03-30T10:34:13.427Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://crates.io/crates/cache_cache","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/pollen-robotics.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-05T09:25:53.000Z","updated_at":"2023-01-17T09:45:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"d7377f39-c6ba-4bbc-aae4-381f35920831","html_url":"https://github.com/pollen-robotics/cache_cache","commit_stats":{"total_commits":26,"total_committers":1,"mean_commits":26.0,"dds":0.0,"last_synced_commit":"f7f5147c23cc6f41cd89797949bc620ae2029017"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pollen-robotics%2Fcache_cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pollen-robotics%2Fcache_cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pollen-robotics%2Fcache_cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pollen-robotics%2Fcache_cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pollen-robotics","download_url":"https://codeload.github.com/pollen-robotics/cache_cache/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250307796,"owners_count":21409147,"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-11-06T08:11:29.863Z","updated_at":"2025-04-22T19:27:08.481Z","avatar_url":"https://github.com/pollen-robotics.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cache for controlling and reducing IO calls\n\n[![Build Status]][actions] [![Latest Version]][crates.io]\n\n[Build Status]: https://img.shields.io/github/actions/workflow/status/pollen-robotics/cache_cache/rust.yml?branch=master\n[actions]: https://github.com/pollen-robotics/cache_cache/actions?query=branch%3Amaster\n\n[Latest Version]: https://img.shields.io/crates/v/cache_cache.svg\n[crates.io]: https://crates.io/crates/cache_cache\n\n## Overview \n\nThis caching library has been designed for specific use-cases where:\n\n* getting a \"fresh\" value can be time consuming and can fail (eg. IOs with hardware)\n* getting multiple values at once can be more efficient than getting each value independantly.\n\nTypically, its primary use was to retrieve position/speed/temperature/etc from multiple motors using serial communication. In this setup, the motors are daisy chained, and in the protocol used to communicate with them, a specific message can be used to retrieve a register value for multiple motors at once.\n\nMany other caching implementations exist than can better fit other need.\n\n## Documentation\n\n### Example\n\n```rust\nuse cache_cache::Cache;\nuse std::{error::Error, time::Duration};\n\nfn get_position(ids: \u0026[u8]) -\u003e Result\u003cVec\u003cf64\u003e, Box\u003cdyn Error\u003e\u003e {\n    // For simplicity, this function always work.\n    // But it's a mockup for a real world scenario where hardware IO can fail.\n    Ok(ids.iter().map(|\u0026id| id as f64 * 10.0).collect())\n}\n\nfn main() {\n    let mut present_position = Cache::with_expiry_duration(Duration::from_millis(10));\n\n    present_position.insert(10, 0.0);\n\n    let pos = present_position\n        .entries(\u0026[10, 11, 12])\n        .or_try_insert_with(get_position);\n\n    assert!(pos.is_ok());\n    assert_eq!(pos.unwrap(), vec![\u00260.0, \u0026110.0, \u0026120.0]);\n}\n```\n\nSee https://docs.rs/cache_cache for more information on APIs and examples.\n\n## License\n\nThis library is licensed under the Apache License 2.0.\n\n## Support\n\nIt's developed and maintained by [Pollen-Robotics](https://pollen-robotics.com). They developped open-source tools for robotics manipulation.\nVisit https://pollen-robotics.com to learn more or join our Dicord community if you have any questions or want to share your ideas. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpollen-robotics%2Fcache_cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpollen-robotics%2Fcache_cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpollen-robotics%2Fcache_cache/lists"}