{"id":21832939,"url":"https://github.com/null-none/drf-mixin-cache","last_synced_at":"2026-05-18T17:32:06.886Z","repository":{"id":253497260,"uuid":"843690518","full_name":"null-none/drf-mixin-cache","owner":"null-none","description":"Cache provides easy to use cache framework for django-rest-framwork apps","archived":false,"fork":false,"pushed_at":"2024-08-18T12:43:40.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-26T09:28:25.708Z","etag":null,"topics":["cache","django","django-rest-framework","drf","mixins"],"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/null-none.png","metadata":{"files":{"readme":"README.md","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-17T05:52:33.000Z","updated_at":"2024-08-18T12:43:43.000Z","dependencies_parsed_at":"2025-01-26T09:38:09.410Z","dependency_job_id":null,"html_url":"https://github.com/null-none/drf-mixin-cache","commit_stats":null,"previous_names":["null-none/drf-mixin-cache"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/null-none%2Fdrf-mixin-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/null-none%2Fdrf-mixin-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/null-none%2Fdrf-mixin-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/null-none%2Fdrf-mixin-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/null-none","download_url":"https://codeload.github.com/null-none/drf-mixin-cache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244807326,"owners_count":20513613,"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":["cache","django","django-rest-framework","drf","mixins"],"created_at":"2024-11-27T19:27:12.949Z","updated_at":"2026-05-18T17:32:06.858Z","avatar_url":"https://github.com/null-none.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# drf-mixin-cache\n\nEasy to use cache framework for django-rest-framwork apps.\n\n\n# Installation\n\nInstall using `pip`...\n\n    pip install drf_mixin_cache\n\nAdd `'drf_mixin_cache'` to your `INSTALLED_APPS` setting.\n\n```python\nINSTALLED_APPS = (\n    ...\n    'drf_mixin_cache',\n)\n```\n\nYou must execute autodiscover to load your serializers. To do this change your `urls.py` adding the following code:\n\n```python\nfrom drf_mixin_cache.registry import cache_registry\n\ncache_registry.autodiscover()\n```\n\n\n# Usage\n\n```python\nfrom rest_framework import serializers\n\n# You must import the CachedSerializerMixin and cache_registry\nfrom rest_framework_cache.serializers import CachedSerializerMixin\nfrom rest_framework_cache.registry import cache_registry\n\nfrom .models import User\n\n\nclass UserSerializer(serializers.ModelSerializer, CachedSerializerMixin):\n\n    class Meta:\n        model = User\n\n\ncache_registry.register(UserSerializer)\n\n```\n\n\n## Using cache backend different of the default\n\nIf you need use a cache backend different of the default you can specify it on the `REST_FRAMEWORK_CACHE`.\n\nTo do this edit your `settings.py` like this:\n\n```python\n# ...\nCACHES = {\n    'default': {\n        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',\n        'LOCATION': '127.0.0.1:11211',\n    },\n    'locmem': {\n        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',\n        'LOCATION': 'unique-snowflake',\n    }\n}\n\nREST_FRAMEWORK_CACHE = {\n    'DEFAULT_CACHE_BACKEND': 'locmem',\n}\n# ...\n```\n\n## Cache timeout\n\nYou can set the cache timeout using `DEFAULT_CACHE_TIMEOUT`.\n\n```python\nREST_FRAMEWORK_CACHE = {\n    'DEFAULT_CACHE_TIMEOUT': 86400, # Default is 1 day\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnull-none%2Fdrf-mixin-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnull-none%2Fdrf-mixin-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnull-none%2Fdrf-mixin-cache/lists"}