{"id":13936447,"url":"https://github.com/suzaku/cachelper","last_synced_at":"2026-04-04T01:10:32.145Z","repository":{"id":62560631,"uuid":"101525747","full_name":"suzaku/cachelper","owner":"suzaku","description":null,"archived":false,"fork":false,"pushed_at":"2017-09-08T23:21:02.000Z","size":33,"stargazers_count":46,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-27T11:39:26.016Z","etag":null,"topics":["cache","python","python-package"],"latest_commit_sha":null,"homepage":null,"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/suzaku.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-27T02:46:32.000Z","updated_at":"2023-02-16T09:43:04.000Z","dependencies_parsed_at":"2022-11-03T14:45:18.640Z","dependency_job_id":null,"html_url":"https://github.com/suzaku/cachelper","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/suzaku/cachelper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suzaku%2Fcachelper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suzaku%2Fcachelper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suzaku%2Fcachelper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suzaku%2Fcachelper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suzaku","download_url":"https://codeload.github.com/suzaku/cachelper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suzaku%2Fcachelper/sbom","scorecard":{"id":860725,"data":{"date":"2025-08-11","repo":{"name":"github.com/suzaku/cachelper","commit":"7da36614f9a23abb97c4d4c871dd45e07080dfb5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"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":"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":"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":"Code-Review","score":0,"reason":"Found 1/25 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":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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 'master'"],"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"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 6 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-24T01:11:25.804Z","repository_id":62560631,"created_at":"2025-08-24T01:11:25.804Z","updated_at":"2025-08-24T01:11:25.804Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31383726,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-03T23:20:52.058Z","status":"ssl_error","status_checked_at":"2026-04-03T23:20:51.675Z","response_time":107,"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":["cache","python","python-package"],"created_at":"2024-08-07T23:02:40.861Z","updated_at":"2026-04-04T01:10:32.125Z","avatar_url":"https://github.com/suzaku.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"cachelper\n##########\n\n.. image:: https://travis-ci.org/suzaku/cachelper.svg?branch=master\n    :target: https://travis-ci.org/suzaku/cachelper\n.. image:: https://img.shields.io/pypi/v/cachelper.svg\n    :target: https://pypi.python.org/pypi/cachelper\n.. image:: https://bettercodehub.com/edge/badge/suzaku/cachelper?branch=master\n\nUseful cache helpers in one package!\n\nInstall\n*******\n\n.. code-block:: bash\n\n    pip install cachelper\n\nHelpers\n*******\n\nIn memory cache\n===============\n\nmemoize\n---------------\n\nCaching function return values in memory.\n\n\n.. code-block:: python\n\n    import cachelper\n\n    @cachelper.memoize()\n    def fibo(n):\n        if n in (0, 1):\n            return 1\n        return fibo(n - 1) + fibo(n - 2)\n\n    fibo(10)\n\nCache with Redis/Memcached\n==============================\n\nUsing the HelperMixin\n---------------------\n\n``HelperMixin`` can be used with any cache client classes that implement the following methods:\n\n- ``def get(self, key)``\n- ``def set(self, key, value, timeout=None)``\n- ``def delete(self, key)``\n- ``def get_many(self, keys)``\n- ``def set_many(self, mapping, timeout=None)``\n\nFor example, `RedisCache` from `werkzeug` is one such class:\n\n.. code-block:: python\n\n    from redis import StrictRedis\n    from werkzeug.contrib.cache import RedisCache as _RedisCache\n\n    from cachelper import HelperMixin\n\n    class RedisCache(_RedisCache, HelperMixin):\n        '''werkzeug.contrib.cache.RedisCache mixed with HelperMixin'''\n\n        def get_many(self, keys):\n            return super().get_many(*keys)\n\n    rds = StrictRedis()\n    cache = RedisCache(rds)\n\nThis mixin defines these methods: ``call``, ``map``, ``__call__``.\nIf your class already defines methods of the same name, the mixin methods may not work correctly.\n\n\ncache decorator\n---------------\n\nAdd cache by decorating a function or method.\n\n.. code-block:: python\n\n    @cache(\"key-{user_id}\", timeout=300)\n    def get_name(user_id):\n        # Fetch user name from database\n        ...\n\nThe cache key template can also be a function which acts as a key factory:\n\n.. code-block:: python\n\n    def name_key(user_id):\n        return \"key-%s\" % user_id\n\n    @cache(name_key, timeout=300)\n    def get_name(user_id):\n        # Fetch user name from database\n        ...\n\nJust make sure the key factory function accepts the same parameters as the cached\nfunction and returns the key.\n\ncached function calls\n------------------------------\n\nSometimes we don't want to cache all calls to a specific function.\nSo the decorator is not suitable, we may cache the call instead the function in this case:\n\n\n.. code-block:: python\n\n    def get_name(user_id):\n        # Fetch user name from database\n        ...\n\n    user_id = 42\n    key = \"key-{user_id}\".format(user_id=user_id)\n    cache.call(lambda: get_name(user_id), key, timeout=300)\n\ncached multiple calls\n------------------------------\n\nFor most cache backends, it's much faster to get or set caches in bulk.\n\n.. code-block:: python\n\n    def get_name(user_id):\n        # Fetch user name from database\n        ...\n\n    user_ids = [1, 2, 42, 1984]\n    names = cache.map(\"key-{user_id}\", get_name, user_ids, timeout=300)\n\n.. image:: https://app.codesponsor.io/embed/MY7qFCdB7bDgiBqdjtV9ASYi/suzaku/cachelper.svg\n    :width: 888px\n    :height: 68px\n    :alt: Sponsor\n    :target: https://app.codesponsor.io/link/MY7qFCdB7bDgiBqdjtV9ASYi/suzaku/cachelper\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuzaku%2Fcachelper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuzaku%2Fcachelper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuzaku%2Fcachelper/lists"}