{"id":23009582,"url":"https://github.com/devolutions/mouscache-rs","last_synced_at":"2025-12-12T12:16:21.525Z","repository":{"id":57640470,"uuid":"130068624","full_name":"Devolutions/mouscache-rs","owner":"Devolutions","description":"An in-memory or distributed memory cache, with style","archived":false,"fork":false,"pushed_at":"2022-03-10T15:48:24.000Z","size":71,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-06-19T22:07:58.675Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/Devolutions.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":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2018-04-18T13:42:50.000Z","updated_at":"2024-10-28T16:58:54.000Z","dependencies_parsed_at":"2022-09-05T05:31:24.311Z","dependency_job_id":null,"html_url":"https://github.com/Devolutions/mouscache-rs","commit_stats":null,"previous_names":["wayk/mouscache-rs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Devolutions/mouscache-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Devolutions%2Fmouscache-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Devolutions%2Fmouscache-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Devolutions%2Fmouscache-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Devolutions%2Fmouscache-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Devolutions","download_url":"https://codeload.github.com/Devolutions/mouscache-rs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Devolutions%2Fmouscache-rs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260838663,"owners_count":23070614,"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-12-15T09:15:02.608Z","updated_at":"2025-12-12T12:16:16.231Z","avatar_url":"https://github.com/Devolutions.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mouscache-rs\n[![Mouscache doc badge](https://docs.rs/mouscache/badge.svg)](https://docs.rs/mouscache/)\n[![dependency status](https://deps.rs/repo/github/Devolutions/mouscache-rs/status.svg)](https://deps.rs/repo/github/Devolutions/mouscache-rs)\n\nA small lib to manipulate object with redis or an in-memory cache\n\n## Basic Usage\n```rust\nuse mouscache;\n\n#[derive(Cacheable, Clone, Debug)]\nstruct YourData {\n    field1: u16,\n    field2: String,\n}\n\nfn main() {\n    let data = YourData {\n        field1: 42,\n        field2: String::from(\"Hello, World!\"),\n    };\n\n    if let Ok(mut cache) = mouscache::redis(\"localhost\", None) {\n        let _ = cache.insert(\"test\", data.clone());\n\n        let data2: YourData = cache.get(\"test\").unwrap();\n\n        assert_eq!(data.field1, data2.field1);\n        assert_eq!(data.field2, data2.field2);\n    }\n}\n```\n\n## Customizing What's Being Cached\nMouscache now support 2 custom attribute to customize entry :\n\n### `expires` Attribute\nSpecifies a duration in sec after which the entry is invalid\n```rust\nuse mouscache;\n\n#[derive(Cacheable, Clone, Debug)]\n#[cache(expires=\"10\")] // each entry of type YouCustomDataType will be valid 10 sec.\nstruct YouCustomDataType {\n    yourPrecious_field: String\n}\n```\n\n### `rename` Attribute\nSpecifies the name which will be used to insert the entry\n```rust\nuse mouscache;\n\n#[derive(Cacheable, Clone, Debug)]\n#[cache(rename=\"ThisNameIsCooler\")] // each entry of type YouCustomDataType will be inserted with ThisNameIsCooler\nstruct YouCustomDataType {\n    yourPrecious_field: String\n}\n```\n\n##TODO\n- [x] Add support for `struct` with named field\n- [x] Add Data Attribute\n- [ ] Add support for unnamed field\n- [ ] Add support for `enum`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevolutions%2Fmouscache-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevolutions%2Fmouscache-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevolutions%2Fmouscache-rs/lists"}