{"id":17037872,"url":"https://github.com/mrkiven/ecache","last_synced_at":"2025-10-14T08:15:00.324Z","repository":{"id":57425414,"uuid":"73381239","full_name":"MrKiven/ECache","owner":"MrKiven","description":":clap::clap: Integrate cache(redis) [flask etc.] with SQLAlchemy.","archived":false,"fork":false,"pushed_at":"2022-12-26T19:59:21.000Z","size":37,"stargazers_count":30,"open_issues_count":3,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-01T03:52:06.122Z","etag":null,"topics":["cache","flask","python","sqlalchemy"],"latest_commit_sha":null,"homepage":"https://git.io/vHrQ1","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/MrKiven.png","metadata":{"files":{"readme":"README.rst","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":"2016-11-10T12:47:20.000Z","updated_at":"2025-02-06T16:03:06.000Z","dependencies_parsed_at":"2023-01-31T00:55:13.720Z","dependency_job_id":null,"html_url":"https://github.com/MrKiven/ECache","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/MrKiven/ECache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrKiven%2FECache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrKiven%2FECache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrKiven%2FECache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrKiven%2FECache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MrKiven","download_url":"https://codeload.github.com/MrKiven/ECache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrKiven%2FECache/sbom","scorecard":{"id":96686,"data":{"date":"2025-08-11","repo":{"name":"github.com/MrKiven/ECache","commit":"44b97f425585972bc8b6b2a399186e88bb843dcd"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.3,"checks":[{"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":"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":"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/29 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":"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":"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE: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":"Vulnerabilities","score":4,"reason":"6 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2022-43017 / GHSA-qwmp-2cf2-g9g6","Warn: Project is vulnerable to: PYSEC-2018-66 / GHSA-562c-5r94-xh97","Warn: Project is vulnerable to: PYSEC-2019-179 / GHSA-5wv5-4vpf-pj6m","Warn: Project is vulnerable to: PYSEC-2023-62 / GHSA-m2qf-hxjv-5gpq","Warn: Project is vulnerable to: PYSEC-2019-124 / GHSA-38fc-9xqv-7f7q","Warn: Project is vulnerable to: PYSEC-2019-123 / GHSA-887w-45rq-vxgf"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 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-15T09:12:06.263Z","repository_id":57425414,"created_at":"2025-08-15T09:12:06.263Z","updated_at":"2025-08-15T09:12:06.263Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018305,"owners_count":26086334,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","flask","python","sqlalchemy"],"created_at":"2024-10-14T08:55:20.887Z","updated_at":"2025-10-14T08:15:00.290Z","avatar_url":"https://github.com/MrKiven.png","language":"Python","readme":"Ecache for sqlalchemy\n=====================\n\n\nRun test\n--------\n\n.. code:: bash\n\n    make unittest\n\n\nInstallation / Rquirements\n--------------------------\n\n.. code::\n\n    pip install ecache\n\n\nUsage\n-----\n\nWith Flask Integrate\n~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n    from flask import Flask, jsonify\n    from flask_sqlalchemy import SQLAlchemy\n\n    from ecache.ext.flask_cache import CacheableMixin, query_callable, regions\n\n    app = Flask(__name__)\n    app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test.db'\n    app.debug = True\n    db = SQLAlchemy(app)\n\n    class User(db.Model, CacheableMixin):\n        \"\"\"Default backend is redis and expiration time is 1 hour, default\n        region name is `default`, you can override this:\n\n            cache_regions = your_regions\n            cache_label = your_label\n        \"\"\"\n\n        id = db.Column(db.Integer, primary_key=True)\n        name = db.Column(db.String)\n\n    @app.route('/users')\n    def all_users():\n        \"\"\"Result will try to get from cache first. load from db if cache miss.\n        \"\"\"\n        users = [user.to_dict() for user in User.cache.filter()]\n        return jsonify(users=users)\n\n\n    @app.route('/users/\u003cint:user_id')\n    def view_user(user_id):\n        \"\"\"Result will try to get from cache first. load from db if cache miss.\n        \"\"\"\n        user = User.cache.get(user_id)\n        return jsonify(user.to_dict())\n\nMore detail see `example`_\n\n.. _`example`: https://github.com/MrKiven/ECache/blob/master/ecache/ext/example.py\n\n\nWith Pure SQLAlchemy model Integrate\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n    # -*- coding: utf-8 -*-\n\n    import redis\n    from sqlalchemy import (Column, Integer, String, SmallInteger)\n\n    from ecache.core import cache_mixin\n    from ecache.db import db_manager, model_base\n\n    # alsosee :class:`ecache.db.DBManager`\n    DBSession = db_manager.get_session('test')\n    cache_client = redis.StrictRedis()\n    CacheMixin = cache_mixin()\n    DeclarativeBase = model_base()\n\n\n    class TodoListModel(DeclarativeBase, CacheMixin):\n        __tablename__ == 'todo_list'\n        TABLE_CACHE_EXPIRATION_TIME = 3600\n\n        id = Column(Integer, primary_key=True)\n        title = Column(String, default='')\n        is_done = Column(SmallInteger, default=0)\n\n        @classmethod\n        def get_todo(cls, todo_id):\n            todo = cls.get(todo_id)  # `cls.get` inherited from `CacheMixin`\n            return todo\n\n        @classmethod\n        def add(cls, title):\n            todo = cls(title=title)\n            s = DBSession()\n            s.add(todo)\n            s.commit()\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrkiven%2Fecache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrkiven%2Fecache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrkiven%2Fecache/lists"}