{"id":44431954,"url":"https://github.com/comtura-ai/fastapi-redis","last_synced_at":"2026-02-12T13:19:16.946Z","repository":{"id":57428512,"uuid":"453833657","full_name":"comtura-ai/fastapi-redis","owner":"comtura-ai","description":"Fastapi Redis client with decorator for controllers","archived":false,"fork":false,"pushed_at":"2022-06-30T13:11:59.000Z","size":40,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-15T05:09:34.422Z","etag":null,"topics":["fastapi","fastapi-redis","redis"],"latest_commit_sha":null,"homepage":"","language":"Python","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/comtura-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-30T23:57:57.000Z","updated_at":"2024-09-23T10:09:04.000Z","dependencies_parsed_at":"2022-09-02T15:31:48.194Z","dependency_job_id":null,"html_url":"https://github.com/comtura-ai/fastapi-redis","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/comtura-ai/fastapi-redis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/comtura-ai%2Ffastapi-redis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/comtura-ai%2Ffastapi-redis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/comtura-ai%2Ffastapi-redis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/comtura-ai%2Ffastapi-redis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/comtura-ai","download_url":"https://codeload.github.com/comtura-ai/fastapi-redis/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/comtura-ai%2Ffastapi-redis/sbom","scorecard":{"id":301957,"data":{"date":"2025-08-11","repo":{"name":"github.com/comtura-ai/fastapi-redis","commit":"cb39967d47a3b4879bbf4ff6718f852b7078b413"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/28 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/main.yaml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yaml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/comtura-ai/fastapi-redis/main.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/main.yaml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/comtura-ai/fastapi-redis/main.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yaml:44: update your workflow using https://app.stepsecurity.io/secureworkflow/comtura-ai/fastapi-redis/main.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/main.yaml:57: update your workflow using https://app.stepsecurity.io/secureworkflow/comtura-ai/fastapi-redis/main.yaml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/main.yaml:22","Warn: pipCommand not pinned by hash: .github/workflows/main.yaml:23","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-17T20:52:32.860Z","repository_id":57428512,"created_at":"2025-08-17T20:52:32.860Z","updated_at":"2025-08-17T20:52:32.860Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29366745,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T08:51:36.827Z","status":"ssl_error","status_checked_at":"2026-02-12T08:51:26.849Z","response_time":55,"last_error":"SSL_read: 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":["fastapi","fastapi-redis","redis"],"created_at":"2026-02-12T13:19:16.109Z","updated_at":"2026-02-12T13:19:16.941Z","avatar_url":"https://github.com/comtura-ai.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fastapi Redis\n\nThis package provides a client that integrates with Fastapi and provides a decorator to cache fastapi controllers responses.\n\n## Installation\n\n`$ pip install fastapi-redis`\n\n## Usage\n\n### Client\n\n#### Setting the data\n\n```python\nimport redis_client from fastapi_redis\n\nredis_client.set('some_key', 'some_data')\n```\n\nModels can be saved as well and the client will serialize them to json:\n\n```python\nimport redis_client from fastapi_redis\nfrom pydantic.main import BaseModel\n\nMyModel(BaseModel):\n    data: str\n\nredis_client.set('some_key', MyModel(data='some_data'))\nredis_client.set('some_key', MyModel(data='some_data_that_expires'), expiration=timedelta(days=1))\n```\n\nThe data can be saved using the [Fastapi Background Tasks](https://fastapi.tiangolo.com/tutorial/background-tasks/) so it wouldn't generate any delay on the response to the user:\n\n```python\nimport redis_client from fastapi_redis\n\n@router.get('/')\nasync def my_controller_method(background_tasks: BackgroundTasks):\n    redis_client.set_in_background(background_tasks, 'some_key', 'some_data')\n    redis_client.set_in_background(background_tasks, 'some_key', MyModel(data='some_data_that_expires'), expiration=timedelta(days=1))\n```\n\n#### Getting the data\n\n```python\nimport redis_client from fastapi_redis\n\nsome_data = redis_client.get('some_key')\n```\n\n### @redis_cache decorator\n\nThe `@redis_cache` decorator can be used to cache the response from a controller. Any argument of the controller can be used to specify the key of the data to store and if `background_tasks: BackgroundTasks` is defined as an argument it will store the data in the background as well:\n\n```python\nimport redis_client from fastapi_redis\n\n\n@router.get('/resource/{id}')\n@router_cache('resource_{id}_{user.id}', timedelta(days=1))\nasync def my_controller_method(id: str,\n                               user: User = Depends(get_current_user)\n                               background_tasks: BackgroundTasks):\n    return some_data_that_will_be_cached\n```\n\n#### Reset data\n\nSometimes you want to reset what's on the cache and reprocess the response of the method/function/api without waiting for the timeout, these can be archieved sending the variable `reset_cache` to the `@router_cache()` decorator:\n\n```python\nimport redis_client from fastapi_redis\n\n\n@router.get('/resource/{id}')\n@router_cache('resource_{id}_{user.id}', timedelta(days=1))\nasync def my_controller_method(id: str,\n                               reset_cache: str = None,\n                               user: User = Depends(get_current_user)\n                               background_tasks: BackgroundTasks):\n    return some_data_that_will_be_cached\n```\n\nThis way when the user sends to this url the query parameter `?reset_cache=true` it will reprocess the data and cache it again.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomtura-ai%2Ffastapi-redis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcomtura-ai%2Ffastapi-redis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomtura-ai%2Ffastapi-redis/lists"}