{"id":37110990,"url":"https://github.com/injectivelabs/injective-cache","last_synced_at":"2026-01-14T13:10:22.061Z","repository":{"id":61628948,"uuid":"551384950","full_name":"InjectiveLabs/injective-cache","owner":"InjectiveLabs","description":"Optional cache layer utility, switch between redis/internal memory cache","archived":false,"fork":false,"pushed_at":"2024-06-13T11:11:02.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-06-21T11:17:05.461Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/InjectiveLabs.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-14T09:51:33.000Z","updated_at":"2024-06-13T11:10:27.000Z","dependencies_parsed_at":"2024-06-20T09:24:42.435Z","dependency_job_id":"b8f96da4-926f-4c06-a8d7-14b3ca0cb9b3","html_url":"https://github.com/InjectiveLabs/injective-cache","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/InjectiveLabs/injective-cache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InjectiveLabs%2Finjective-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InjectiveLabs%2Finjective-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InjectiveLabs%2Finjective-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InjectiveLabs%2Finjective-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InjectiveLabs","download_url":"https://codeload.github.com/InjectiveLabs/injective-cache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InjectiveLabs%2Finjective-cache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28420832,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":[],"created_at":"2026-01-14T13:10:21.385Z","updated_at":"2026-01-14T13:10:22.053Z","avatar_url":"https://github.com/InjectiveLabs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cache and cache\n\n2 types of cache under 1 interface\n\n### SimpleCache (V2)\nSimple cache interface allows to store and retrieve arbitrary types from the cache.\n\nThere are 2 implementations of the SimpleCache interface:\n- SimpleRedisCache\n- TypedLibCache\n\n#### Redis Simple Cache\nWith the Redis Simple Cache, you can choose the way to encode and decode the data to be stored in the cache.\nIf you don't provide a codec, the default codec will be used, which is the `json` codec.\n\n#### Typed Lib Cache\nWith this cache you can store any type in memory, without having to serialize the data, with the caveat that you have to declare the type when you create the cache.\n\n### Resource Coalescing Cache\nResource Coalescing Cache is a cache that allows you to coalesce the requests for the same resource,\nthis means that if there are multiple requests for the same resource, only one request will be made to the backend, \nand the rest of the requests will wait for the first request to finish.\n\nIt includes a cache, so once the first request finishes, it will set the value in the cache and, while is valid, new requests\nwill return the value from the cache.\n\n### New Redis cache\n\n```go\ncache, err := NewRedisCache(context.Background(), \"localhost:6379\", 5*time.Second)\nif err != nil {\n    panic(err)\n}\n\ncache.Set(\"key1\", []byte(\"hello1\"))\ncache.Set(\"key2\", []byte(\"hello2\"))\n\nv, err := cache.Get(\"key2\")\nif err != nil {\n    panic(err)\n}\n\nfmt.Println(v)\n```\n\n### New libcache (in-process cache)\n\n```go\ncache, err := NewLibcache(0, 5*time.Second)\nif err != nil {\n    panic(err)\n}\n\ncache.Set(\"key1\", []byte(\"hello1\"))\ncache.Set(\"key2\", []byte(\"hello2\"))\n\nv, err := cache.Get(\"key2\")\nif err != nil {\n    panic(err)\n}\n\nfmt.Println(v)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finjectivelabs%2Finjective-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finjectivelabs%2Finjective-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finjectivelabs%2Finjective-cache/lists"}