{"id":24557820,"url":"https://github.com/timclicks/cornerstore","last_synced_at":"2025-03-16T18:50:29.429Z","repository":{"id":62438983,"uuid":"361128199","full_name":"timClicks/cornerstore","owner":"timClicks","description":"An in-memory key/value store for read-heavy workloads with expireable items","archived":false,"fork":false,"pushed_at":"2021-04-24T10:08:01.000Z","size":17,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-15T21:54:43.701Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/timClicks.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}},"created_at":"2021-04-24T10:04:42.000Z","updated_at":"2021-08-14T03:10:11.000Z","dependencies_parsed_at":"2022-11-01T23:33:17.571Z","dependency_job_id":null,"html_url":"https://github.com/timClicks/cornerstore","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timClicks%2Fcornerstore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timClicks%2Fcornerstore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timClicks%2Fcornerstore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timClicks%2Fcornerstore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timClicks","download_url":"https://codeload.github.com/timClicks/cornerstore/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243912551,"owners_count":20367880,"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":"2025-01-23T05:29:35.753Z","updated_at":"2025-03-16T18:50:29.408Z","avatar_url":"https://github.com/timClicks.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# about\n\nCORNERSTORE is an easy-to-use, in-memory cache with items which\ncan expire. It can safely be shared across threads.\n\nis a friendly key-value store for perishable items.\nLike corner stores in real life, this one is fast and convenient.\nIt is intended for read-heavy workloads. All key/value pairs can\nbe given an optional expiry time.\n\nA `CornerStore` instance is thread-safe. It divides its data across\n128 shards.\n\n# usage\n\nCORNERSTORE is a library. It does not have a command-line interface or\nlisten to a socket, such as what you might expect from memcached or Redis.\n\nStart by importing `CornerStore` then creating\nand instance with the `new()` method. For the convenience of, it can be useful\nto also bring some types from `std::time` in local scope, as well as the `std::error::Error` trait.\n\n```rust\nuse cornerstore::CornerStore;\nuse std::error::Error;\nuse std::time::{Duration, Instant};\n\n// ...\n\nfn main() -\u003e Result\u003c(), Box\u003cdyn Error + '_\u003e\u003e {\n    let mut store = CornerStore::new();\n\n    // ...\n\n    Ok(())\n}\n```\n\nSome examples of the API:\n\n* Storing an item that does not expire:\n\n    ```rust\n    let key = b\"greeting\";\n    let value = b\"hello\";\n    let expiry = None;\n    store.set(key, expected_value, expiry)?;\n    ```\n\n* Storing an item that expires in one minute:\n\n    ```rust\n    let key = b\"greeting\";\n    let value = b\"hello from the future\";\n    let expiry = Some(Instant::now() + Duration::new(60, 0))\n    store.set(key, expected_value, expiry)?;\n    ```\n\n* Retrieving an item:\n\n    ```rust\n    let key   = b\"greeting\";\n    if Some(value) = store.get(key)? {\n        // warning - prints raw bytes\n        println!(\"{:?}\", value);\n    };\n    ```\n\n* Retrieving an item without checking the expiry date:\n\n    ```rust\n    let key   = b\"greeting\";\n    if Some(value) = store.get_unchecked(key)? {\n        // warning - prints raw bytes\n        println!(\"{:?}\", value);\n    };\n    ```\n\n* Remove any expired perishable items from the store:\n\n    ```rust\n    store.evict()?;\n    ```\n\n## cargo features\n\n- `safe-input`  \n   If you know that your store will not be subjected to DDoS attacks,\n   you can increase its performance by enabling `safe-input`. `safe-input` \n   uses the `fxcrate` for hashing, which is faster than Rust's default.\n\n# goals\n\nTo act as a library for many client language implementations.\n\n## help wanted\n\n- Is it possible to avoid returning `Result\u003cOption\u003cK, V\u003e\u003e` when returning a value? Unwrapping twice is slightly icky.\n- how to benchmark this thing? I've experimented a little bit with jonhoo's `bustle` crate, but it's hard to coerce `[u8]` streams to `f64`.\n\n# legal\n\n_Sorry about the legalese. It's unfortunate, but important._\n\n## authorship and copyright\n\nOriginal components of CORNERSTORE have been written by\nTim McNamara (@timClicks). Copyright these contributions\nhave been assigned to Fiorenza Limited (NZBN 9429042165200).\n\nCORNERSTORE source and binary distributions are released\nunder the Apache 2 License. See the LICENCE file for your\nrights and obligations under this licence.\n\n## trade mark\n\nCORNERSTORE is an unregistered trade mark of Fiorenza Limited\n(NZBN 9429042165200).\n\n## consumer projection\n\nIf you are using CORNERSTORE for your own use, you are entitled\nto mandatory rights under the Consumer Guarantees Act. Please\nbear in mind that you are getting software for free that you\nhave randomly downloaded from the Internet.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimclicks%2Fcornerstore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimclicks%2Fcornerstore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimclicks%2Fcornerstore/lists"}