{"id":37127160,"url":"https://github.com/dstdfx/bookish-spork","last_synced_at":"2026-01-14T14:48:33.538Z","repository":{"id":57542358,"uuid":"292824117","full_name":"dstdfx/bookish-spork","owner":"dstdfx","description":null,"archived":false,"fork":false,"pushed_at":"2020-09-12T18:16:57.000Z","size":446,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T02:08:55.083Z","etag":null,"topics":["cache","go","http-api"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dstdfx.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}},"created_at":"2020-09-04T10:53:25.000Z","updated_at":"2020-09-12T18:16:59.000Z","dependencies_parsed_at":"2022-09-26T18:31:11.938Z","dependency_job_id":null,"html_url":"https://github.com/dstdfx/bookish-spork","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dstdfx/bookish-spork","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dstdfx%2Fbookish-spork","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dstdfx%2Fbookish-spork/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dstdfx%2Fbookish-spork/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dstdfx%2Fbookish-spork/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dstdfx","download_url":"https://codeload.github.com/dstdfx/bookish-spork/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dstdfx%2Fbookish-spork/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28423994,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T13:30:50.153Z","status":"ssl_error","status_checked_at":"2026-01-14T13:29:08.907Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","go","http-api"],"created_at":"2026-01-14T14:48:32.968Z","updated_at":"2026-01-14T14:48:33.530Z","avatar_url":"https://github.com/dstdfx.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bookish-spork\n\nSimple Go application that provides HTTP API to in-memory cache\n\n## Public API\n\n- `/v1/set` - set value to cache\n\nExample:\n```bash\ncurl -i -X POST \"127.0.0.1:63100/v1/set\" -H \"Content-Type: application/json\" \\\n                                         -d '{\"key\": \"some-key\", \"value\": \"some-value\", \"ttl\": 10}'\nHTTP/1.1 200 OK\nDate: Fri, 04 Sep 2020 16:33:37 GMT\nContent-Length: 0\n```\n\nIf `ttl` is equal or less to 0 it means that the key will never get expired.\n\n- `/v1/get/\u003ckey\u003e` - get value from cache\n\nExample:\n```bash\ncurl -s -X GET \"127.0.0.1:63100/v1/get/some-key\" | json_pp\n{\n   \"value\" : \"some-value\"\n}\n```\n\n- `/v1/keys` - get list of all keys in cache\n\nExample:\n```bash\ncurl -s -X GET \"127.0.0.1:63100/v1/keys\" | json_pp\n{\n   \"keys\" : [\n      \"some-key\",\n      \"some-key-1\"\n   ]\n}\n```\n\n- `/v1/remove/\u003ckey\u003e` - remove key from cache\n\nExample:\n```bash\ncurl -i -X DELETE \"127.0.0.1:63100/v1/remove/some-key\"\nHTTP/1.1 204 No Content\nDate: Fri, 04 Sep 2020 16:38:33 GMT\n```\n\n- `/v1/rpush` - add value to a list or create a new one\n\nExample:\n```bash\ncurl -i  -X POST \"127.0.0.1:63100/v1/rpush\" -H \"Content-Type: application/json\" \\\n                                            -d '{\"key\": \"some-key\", \"value\": \"some-value\", \"ttl\": 0}'\nHTTP/1.1 200 OK\nDate: Fri, 04 Sep 2020 16:42:13 GMT\nContent-Length: 0\n\ncurl -i  -X POST \"127.0.0.1:63100/v1/rpush\" -H \"Content-Type: application/json\" \\\n                                            -d '{\"key\": \"some-key\", \"value\": \"some-value-1\"}'\nHTTP/1.1 200 OK\nDate: Fri, 04 Sep 2020 16:43:01 GMT\nContent-Length: 0\n\ncurl -s -X GET \"127.0.0.1:63100/v1/get/some-key\" | json_pp\n{\n   \"value\" : [\n      \"some-value\",\n      \"some-value-1\"\n   ]\n}\n```\n\n- `/v1/lindex/\u003ckey\u003e/\u003clist-index\u003e` - get value by the index in list\n\nExample:\n```bash\ncurl -s -X GET \"127.0.0.1:63100/v1/lindex/some-key/0\" | json_pp\n{\n   \"value\" : \"some-value\"\n}\n\ncurl -s -X GET \"127.0.0.1:63100/v1/lindex/some-key/1\" | json_pp\n{\n   \"value\" : \"some-value-1\"\n}\n\ncurl -s -X GET \"127.0.0.1:63100/v1/lindex/some-key/2\" | json_pp\n{\n   \"value\" : null\n}\n\ncurl -s -X GET \"127.0.0.1:63100/v1/lindex/some-key/-2\" | json_pp\n{\n   \"error\" : \"index can't be negative\"\n}\n```\n\n- `/v1/hset` - add key-value pairs to hash map or create a new one\n\nExample:\n```bash\ncurl -i  -X POST \"127.0.0.1:63100/v1/hset\" -H \"Content-Type: application/json\"\n                                           -d '{\"key\": \"some-hm\", \"value\": {\"k0\": \"v0\", \"k1\": \"v1\"}, \"ttl\": 0}'\nHTTP/1.1 200 OK\nDate: Fri, 04 Sep 2020 16:46:32 GMT\nContent-Length: 0\n\ncurl -s -X GET \"127.0.0.1:63100/v1/get/some-hm\" | json_pp\n{\n   \"value\" : {\n      \"k1\" : \"v1\",\n      \"k0\" : \"v0\"\n   }\n}\n```\n\n- `/v1/hget/\u003ckey\u003e/\u003chash-map-key\u003e` - get a value by hash map key\n\nExample:\n```bash\ncurl -s -X GET \"127.0.0.1:63100/v1/hget/some-hm/k0\" | json_pp\n{\n   \"value\" : \"v0\"\n}\n\ncurl -s -X GET \"127.0.0.1:63100/v1/hget/some-hm/k1\" | json_pp\n{\n   \"value\" : \"v1\"\n}\n\ncurl -s -X GET \"127.0.0.1:63100/v1/hget/some-hm/k3\" | json_pp\n{\n   \"value\" : null\n}\n```\n\nYou could also use [HTTP API client](httpclient) in Go to access the API.\n\n## Service API\n\nService API provides standard [pprof](https://golang.org/pkg/net/http/pprof/) endpoints.\nBy default, it listens at port 63101.\n\nExample of fetching profile over HTTP:\n```bash\ngo tool pprof http://127.0.0.1:63101/debug/pprof/profile\n```\n\nYou could also visit `http://127.0.0.1:63101/debug/pprof/` in your browser and do some profiling.\n\n## Build\n\nUse the following command to build binary:\n\n```bash\nmake build\n```\n\nOr you can build Docker image:\n\n```bash\ndocker build -t bookish-spork .\n```\n\n## Running\n\nExample of config file: [bookish-spork.yaml](bookish-spork.example.yaml)\n\nRunning locally:\n```bash\n./bookish-spork --config \u003cpath-to-yaml-config\u003e\n```\n\nRunning in Docker (requires `bookish-spork` image to be build, see the commands above):\n```bash\ndocker run -p 63101:63101 -p 63100:63100 \\\n           -v (pwd)/bookish-spork.yaml:/etc/bookish-spork/bookish-spork.yaml \\\n           bookish-spork\n```\n\nNote, that running the command above you should have `bookish-spork.yaml` locally.\n\n## Testing\n\nUse the following command to run acceptance tests (you will need `docker-compose`):\n\n```sh\nmake acc-tests\n```\n\nUse the following command to run only unit-tests and linters:\n\n```sh\nmake tests\n```\n\nUse the following command to run only unit-tests:\n\n```sh\nmake unittest\n```\n\n## Linters\n\nUse the following command to run golangci-lint:\n\n```sh\nmake golangci-lint\n```\n\nUse the following command to run golangci-lint with unit-tests:\n\n```sh\nmake tests\n```\n\n## TODO\n\n* Auth\n* Scaling support\n* Load testing\n* Add ability to dump cache to disk\n* Code refactoring of `http` and `qqcache` packages\n* Add missing functions to work with `list` and `hash maps`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdstdfx%2Fbookish-spork","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdstdfx%2Fbookish-spork","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdstdfx%2Fbookish-spork/lists"}