{"id":18493776,"url":"https://github.com/neurocode-io/cache-offloader","last_synced_at":"2025-06-15T08:38:35.684Z","repository":{"id":37496482,"uuid":"393023122","full_name":"neurocode-io/cache-offloader","owner":"neurocode-io","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-24T09:20:36.000Z","size":268,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-24T10:27:27.275Z","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/neurocode-io.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":"2021-08-05T11:51:57.000Z","updated_at":"2025-05-24T09:20:24.000Z","dependencies_parsed_at":"2023-02-15T10:40:52.463Z","dependency_job_id":"d819aff8-f0af-4cc2-9818-e70c7e578ec7","html_url":"https://github.com/neurocode-io/cache-offloader","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/neurocode-io/cache-offloader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neurocode-io%2Fcache-offloader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neurocode-io%2Fcache-offloader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neurocode-io%2Fcache-offloader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neurocode-io%2Fcache-offloader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neurocode-io","download_url":"https://codeload.github.com/neurocode-io/cache-offloader/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neurocode-io%2Fcache-offloader/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259945666,"owners_count":22935865,"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-11-06T13:16:00.502Z","updated_at":"2025-06-15T08:38:35.663Z","avatar_url":"https://github.com/neurocode-io.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cache-offloader\n[![CICD](https://github.com/neurocode-io/cache-offloader/actions/workflows/main.yml/badge.svg)](https://github.com/neurocode-io/cache-offloader/actions/workflows/main.yml)\n[![GitHub go.mod Go version of a Go module](https://img.shields.io/github/go-mod/go-version/gomods/athens.svg)](https://github.com/gomods/athens)\n\n\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=neurocode-io_cache-offloader\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=neurocode-io_cache-offloader)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=neurocode-io_cache-offloader\u0026metric=sqale_rating)](https://sonarcloud.io/dashboard?id=neurocode-io_cache-offloader)\n[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=neurocode-io_cache-offloader\u0026metric=reliability_rating)](https://sonarcloud.io/dashboard?id=neurocode-io_cache-offloader)\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=neurocode-io_cache-offloader\u0026metric=security_rating)](https://sonarcloud.io/dashboard?id=neurocode-io_cache-offloader)\n[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=neurocode-io_cache-offloader\u0026metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=neurocode-io_cache-offloader)\n\n\n\n# Using the service\n\nThis service provides a stale while revalidate cache for your HTTP requests. If a request is made to a URL that is already in the cache, the cache will be used. The cache will also be used if the cache is stale. However, an asynchronous request will be made to the server to refresh the cache.\n\nCheck out the `dev.env` file for configuration options.\n\nEssentially you can choose between in-memory or redis persistence. \n\nRedis persistence is recommended when you have multiple processes running the service (or multiple pods).\n\n\nThe environment variable CACHE_IGNORE_ENDPOINTS defines the endpoints that are allowed to passthrough without any caching.\n\nYou can also choose to incude query parameters in the cache key. `CACHE_SHOULD_HASH_QUERY` is a boolean flag that defines whether or not to hash the query parameters. \n\nFor example if you have a request to `/api/v1/users?id=1` and `CACHE_SHOULD_HASH_QUERY` is set to `true`, the cache key will be `/api/v1/users?id=1`. If `CACHE_SHOULD_HASH_QUERY` is set to `false`, the cache key will be `/api/v1/users`.\n\nYou can also configure `CACHE_HASH_QUERY_IGNORE` to ignore certain query parameters from the cache key. For example if you have a request to `/api/v1/users?id=1\u0026utm=1` and `CACHE_HASH_QUERY_IGNORE=utm` the cache key will be `/api/v1/users?id=1`.\n\n\nAnother useful configuration option is `CACHE_STALE_WHILE_REVALIDATE_SEC`. This defines the time in seconds that the cache entry is considered stale and the cache is revalidated asynchronously.\n\n\n# Dev\n\n```\nmake run\n```\n\nCheck its working:\n\n```\nhttp localhost:8000/probes/readiness\n```\n\n# Test\n\n```\ngo install github.com/golang/mock/mockgen@latest\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneurocode-io%2Fcache-offloader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneurocode-io%2Fcache-offloader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneurocode-io%2Fcache-offloader/lists"}