{"id":22217166,"url":"https://github.com/crystal-community/kiwi","last_synced_at":"2025-07-27T14:31:08.928Z","repository":{"id":45976515,"uuid":"62927100","full_name":"crystal-community/kiwi","owner":"crystal-community","description":"A unified Crystal interface for key-value stores.","archived":false,"fork":false,"pushed_at":"2023-08-31T19:54:20.000Z","size":23,"stargazers_count":62,"open_issues_count":4,"forks_count":8,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-05-06T00:04:50.727Z","etag":null,"topics":["crystal","memorystore"],"latest_commit_sha":null,"homepage":"","language":"Crystal","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/crystal-community.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2016-07-09T01:53:34.000Z","updated_at":"2024-04-01T00:11:11.000Z","dependencies_parsed_at":"2022-08-26T09:30:46.964Z","dependency_job_id":null,"html_url":"https://github.com/crystal-community/kiwi","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crystal-community%2Fkiwi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crystal-community%2Fkiwi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crystal-community%2Fkiwi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crystal-community%2Fkiwi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crystal-community","download_url":"https://codeload.github.com/crystal-community/kiwi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227810270,"owners_count":17823176,"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":["crystal","memorystore"],"created_at":"2024-12-02T22:15:28.778Z","updated_at":"2024-12-02T22:15:31.156Z","avatar_url":"https://github.com/crystal-community.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kiwi\n\n[![Build Status](https://travis-ci.org/crystal-community/kiwi.svg?branch=master)](https://travis-ci.org/crystal-community/kiwi)\n\nA simple unified Crystal interface for key-value stores.\n\n* [Installation](#installation)\n* [Usage](#usage)\n  * [MemoryStore](#memorystore)\n  * [FileStore](#filestore)\n  * [RedisStore](#redisstore)\n  * [LevelDBStore](#leveldbstore)\n  * [MemcachedStore](#memcachedstore)\n* [Benchmark](#benchmark)\n* [Tests](#tests)\n* [Contributors](#contributors)\n\n## Installation\n\nAdd this to your application's `shard.yml`:\n\n```yaml\ndependencies:\n  kiwi:\n    github: crystal-community/kiwi\n    version: ~\u003e 0.1.0\n```\n\n## Usage\n\nAll the stores have the same simple interface defined by\n[Kiwi::Store](https://github.com/greyblake/crystal-kiwi/blob/master/src/kiwi/store.cr):\n* `set(key : String, value : String) : String`\n* `get(key : String) : String|Nil`\n* `delete(key : String) : String|Nil`\n* `clear`\n* `[]=(key : String, value) : String` - alias for `set`\n* `[](key : String) : String` - alias for `get`\n\n### MemoryStore\n\n```crystal\nrequire \"kiwi/memory_store\"\n\nstore = Kiwi::MemoryStore.new\n\nstore.set(\"key\", \"value\")\nstore.get(\"key\")  # =\u003e \"value\"\nstore.delete(\"key\")\nstore.clear\n\n# Or your can use Hash-like methods:\nstore[\"key\"] = \"new value\"\nstore[\"key\"]  # =\u003e \"new \"value\"\n```\n\n### FileStore\n\n```crystal\nrequire \"kiwi/file_store\"\n\nstore = Kiwi::FileStore(\"/tmp/kiwi\")\n```\n\n### RedisStore\n\nRedisStore requires you to have [redis shard](https://github.com/stefanwille/crystal-redis).\n\n```crystal\nrequire \"redis\"\nrequire \"kiwi/redis_store\"\n\nstore = Kiwi::RedisStore(Redis.new)\n```\n\n### LevelDBStore\n\nLevelDBStore requires you to have [levelDB shard](https://github.com/crystal-community/leveldb).\n\n```crystal\nrequire \"leveldb\"\nrequire \"kiwi/leveldb_store\"\n\nleveldb = LevelDB::DB.new(\"./db\")\nstore = Kiwi::LevelDBStore(leveldb)\n```\n\n### MemcachedStore\n\nMemcachedStore requires you to have [memcached shard](https://github.com/comandeo/crystal-memcached).\n\n```crystal\nrequire \"memcached\"\nrequire \"kiwi/memcached_store\"\n\nstore = Kiwi::MemcachedStore.new(Memcached::Client.new)\n```\n\n## Benchmark\n\nThe following table shows **operations per second** for every particular store on my machine.\n\n|                    | set     | get     | get(empty) | delete   |\n| ------------------:| -------:| -------:| ----------:| --------:|\n| **MemoryStore**    | 3056000 | 4166000 |    4074000 | 10473000 |\n| **LevelDBStore**   |  120000 |  193000 |     253000 |    37000 |\n| **RedisStore**     |   41000 |   42000 |      42000 |    21000 |\n| **MemcachedStore** |   38000 |   41000 |      40000 |    21000 |\n| **FileStore**      |   27000 |   66000 |      73000 |     8000 |\n\nData information:\n* Key size: 5-100 bytes.\n* Value size: 10-1000 bytes.\n* Number of items: 100,000\n\n\nEnvironment information:\n* CPU: Intel(R) Core(TM) i7-3632QM CPU @ 2.20GHz\n* File System: ext4, SSD\n* RAM: DDR3, 1600 MHz\n* Operating system: 3.16.0-4-amd64 x86_64 GNU/Linux\n\nResults can vary on different systems depending on hardware(CPU, RAM, HDD/SSD) and software(OS, file system, etc).\n\n### Running benchmark\n\n```\nmake benchmark\n```\n\n## Tests\n\nRun specs for all stores:\n```\nmake test\n```\n\nRun spec for a particular store:\n\n```\ncrystal spec ./spec/kiwi/file_store_spec.cr\n```\n\n## Contributors\n\n- [greyblake](https://github.com/greyblake) Sergey Potapov - creator, maintainer.\n- [mauricioabreu](https://github.com/mauricioabreu) Mauricio de Abreu Antunes - thanks for MemcachedStore.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrystal-community%2Fkiwi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrystal-community%2Fkiwi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrystal-community%2Fkiwi/lists"}