django-cache-cleaner 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cache_cleaner/__init__.py +0 -0
- cache_cleaner/admin.py +37 -0
- cache_cleaner/apps.py +8 -0
- cache_cleaner/locale/en/LC_MESSAGES/django.mo +0 -0
- cache_cleaner/locale/en/LC_MESSAGES/django.po +42 -0
- cache_cleaner/locale/it/LC_MESSAGES/django.mo +0 -0
- cache_cleaner/locale/it/LC_MESSAGES/django.po +42 -0
- cache_cleaner/management/__init__.py +0 -0
- cache_cleaner/management/commands/__init__.py +0 -0
- cache_cleaner/management/commands/clear_cache.py +76 -0
- cache_cleaner/metadata.py +10 -0
- cache_cleaner/migrations/0001_initial.py +29 -0
- cache_cleaner/migrations/__init__.py +0 -0
- cache_cleaner/models.py +35 -0
- django_cache_cleaner-0.1.0.dist-info/LICENSE.txt +21 -0
- django_cache_cleaner-0.1.0.dist-info/METADATA +168 -0
- django_cache_cleaner-0.1.0.dist-info/RECORD +19 -0
- django_cache_cleaner-0.1.0.dist-info/WHEEL +5 -0
- django_cache_cleaner-0.1.0.dist-info/top_level.txt +1 -0
|
File without changes
|
cache_cleaner/admin.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from django.contrib import admin, messages
|
|
2
|
+
from django.core.cache import caches
|
|
3
|
+
from django.utils.translation import gettext_lazy as _
|
|
4
|
+
|
|
5
|
+
from cache_cleaner.models import Cache
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@admin.action(description=_("Clear selected caches"))
|
|
9
|
+
def clear_caches(modeladmin, request, queryset):
|
|
10
|
+
for cache_obj in queryset:
|
|
11
|
+
cache_name = cache_obj.name
|
|
12
|
+
cache = caches[cache_name]
|
|
13
|
+
cache.clear()
|
|
14
|
+
caches_names = [cache_obj.name for cache_obj in queryset]
|
|
15
|
+
caches_names_str = ", ".join(caches_names)
|
|
16
|
+
messages.success(request, _("Cleared caches:") + f" {caches_names_str}.")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@admin.register(Cache)
|
|
20
|
+
class CacheAdmin(admin.ModelAdmin):
|
|
21
|
+
search_fields = ("name",)
|
|
22
|
+
list_display = ("name",)
|
|
23
|
+
actions = [clear_caches]
|
|
24
|
+
show_full_result_count = False
|
|
25
|
+
|
|
26
|
+
def get_queryset(self, request):
|
|
27
|
+
Cache.update_from_settings()
|
|
28
|
+
return super().get_queryset(request)
|
|
29
|
+
|
|
30
|
+
def has_add_permission(self, request, obj=None):
|
|
31
|
+
return False
|
|
32
|
+
|
|
33
|
+
def has_change_permission(self, request, obj=None):
|
|
34
|
+
return False
|
|
35
|
+
|
|
36
|
+
def has_delete_permission(self, request, obj=None):
|
|
37
|
+
return False
|
cache_cleaner/apps.py
ADDED
|
Binary file
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# SOME DESCRIPTIVE TITLE.
|
|
2
|
+
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
|
3
|
+
# This file is distributed under the same license as the PACKAGE package.
|
|
4
|
+
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
|
5
|
+
#
|
|
6
|
+
#, fuzzy
|
|
7
|
+
msgid ""
|
|
8
|
+
msgstr ""
|
|
9
|
+
"Project-Id-Version: PACKAGE VERSION\n"
|
|
10
|
+
"Report-Msgid-Bugs-To: \n"
|
|
11
|
+
"POT-Creation-Date: 2024-06-25 14:47-0500\n"
|
|
12
|
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
13
|
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
14
|
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
15
|
+
"Language: \n"
|
|
16
|
+
"MIME-Version: 1.0\n"
|
|
17
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
18
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
19
|
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
|
20
|
+
#: cache_cleaner/admin.py
|
|
21
|
+
msgid "Clear selected caches"
|
|
22
|
+
msgstr ""
|
|
23
|
+
|
|
24
|
+
#: cache_cleaner/admin.py
|
|
25
|
+
msgid "Cleared caches:"
|
|
26
|
+
msgstr "Cleared caches:"
|
|
27
|
+
|
|
28
|
+
#: cache_cleaner/apps.py
|
|
29
|
+
msgid "Cache Cleaner"
|
|
30
|
+
msgstr "Cache Cleaner"
|
|
31
|
+
|
|
32
|
+
#: cache_cleaner/models.py
|
|
33
|
+
msgid "Cache"
|
|
34
|
+
msgstr "Cache"
|
|
35
|
+
|
|
36
|
+
#: cache_cleaner/models.py
|
|
37
|
+
msgid "Caches"
|
|
38
|
+
msgstr "Caches"
|
|
39
|
+
|
|
40
|
+
#: cache_cleaner/models.py
|
|
41
|
+
msgid "Name"
|
|
42
|
+
msgstr "Name"
|
|
Binary file
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# SOME DESCRIPTIVE TITLE.
|
|
2
|
+
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
|
3
|
+
# This file is distributed under the same license as the PACKAGE package.
|
|
4
|
+
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
|
5
|
+
#
|
|
6
|
+
#, fuzzy
|
|
7
|
+
msgid ""
|
|
8
|
+
msgstr ""
|
|
9
|
+
"Project-Id-Version: PACKAGE VERSION\n"
|
|
10
|
+
"Report-Msgid-Bugs-To: \n"
|
|
11
|
+
"POT-Creation-Date: 2024-06-25 14:47-0500\n"
|
|
12
|
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
13
|
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
14
|
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
15
|
+
"Language: \n"
|
|
16
|
+
"MIME-Version: 1.0\n"
|
|
17
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
18
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
19
|
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
|
20
|
+
#: cache_cleaner/admin.py
|
|
21
|
+
msgid "Clear selected caches"
|
|
22
|
+
msgstr ""
|
|
23
|
+
|
|
24
|
+
#: cache_cleaner/admin.py
|
|
25
|
+
msgid "Cleared caches:"
|
|
26
|
+
msgstr "Cleared caches:"
|
|
27
|
+
|
|
28
|
+
#: cache_cleaner/apps.py
|
|
29
|
+
msgid "Cache Cleaner"
|
|
30
|
+
msgstr "Cache Cleaner"
|
|
31
|
+
|
|
32
|
+
#: cache_cleaner/models.py
|
|
33
|
+
msgid "Cache"
|
|
34
|
+
msgstr "Cache"
|
|
35
|
+
|
|
36
|
+
#: cache_cleaner/models.py
|
|
37
|
+
msgid "Caches"
|
|
38
|
+
msgstr "Caches"
|
|
39
|
+
|
|
40
|
+
#: cache_cleaner/models.py
|
|
41
|
+
msgid "Name"
|
|
42
|
+
msgstr "Nome"
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
from django.core.cache import cache, caches
|
|
2
|
+
from django.core.management.base import BaseCommand
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Command(BaseCommand):
|
|
6
|
+
"""
|
|
7
|
+
A Django management command to clear the cache.
|
|
8
|
+
This command allows you to clear the entire cache or individual caches.
|
|
9
|
+
|
|
10
|
+
Options:
|
|
11
|
+
cache_names (list, optional): A list of one or more cache names to clear.
|
|
12
|
+
--all (bool, optional): A flag to clear all defined cache backends.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
help = "Clear the entire cache or individual caches."
|
|
16
|
+
|
|
17
|
+
def _stdout_success(self, message):
|
|
18
|
+
self.stdout.write(self.style.SUCCESS(message))
|
|
19
|
+
|
|
20
|
+
def _stdout_error(self, message):
|
|
21
|
+
self.stderr.write(self.style.ERROR(message))
|
|
22
|
+
|
|
23
|
+
def add_arguments(self, parser):
|
|
24
|
+
"""
|
|
25
|
+
Adds arguments to the command parser.
|
|
26
|
+
|
|
27
|
+
* cache_names: A list of cache names to clear.
|
|
28
|
+
* --all: A flag to clear all caches.
|
|
29
|
+
"""
|
|
30
|
+
parser.add_argument(
|
|
31
|
+
"cache_names",
|
|
32
|
+
nargs="*",
|
|
33
|
+
type=str,
|
|
34
|
+
help="List of specific cache names to clear",
|
|
35
|
+
)
|
|
36
|
+
parser.add_argument(
|
|
37
|
+
"--all",
|
|
38
|
+
action="store_true",
|
|
39
|
+
dest="clear_all",
|
|
40
|
+
help="Clear all caches",
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
def _clear_all_caches(self):
|
|
44
|
+
for cache_name in caches:
|
|
45
|
+
caches[cache_name].clear()
|
|
46
|
+
self._stdout_success(f"Cleared cache '{cache_name}'!")
|
|
47
|
+
self._stdout_success("Cleared all caches!")
|
|
48
|
+
|
|
49
|
+
def _clear_default_cache(self):
|
|
50
|
+
cache.clear()
|
|
51
|
+
self._stdout_success("Cleared default cache!")
|
|
52
|
+
|
|
53
|
+
def _clear_individual_caches(self, cache_names):
|
|
54
|
+
for cache_name in cache_names:
|
|
55
|
+
if cache_name in caches:
|
|
56
|
+
caches[cache_name].clear()
|
|
57
|
+
self._stdout_success(f"Cleared cache '{cache_name}'!")
|
|
58
|
+
else:
|
|
59
|
+
self._stdout_error(f"Cache '{cache_name}' does not exist!")
|
|
60
|
+
|
|
61
|
+
def handle(self, *args, **options):
|
|
62
|
+
"""
|
|
63
|
+
Handles the cache clearing based on the provided arguments.
|
|
64
|
+
|
|
65
|
+
* If `clear_all` is True, clears all defined cache backends.
|
|
66
|
+
* If specific `cache_names` are provided, clears those caches if they exist.
|
|
67
|
+
* If no arguments are provided, clears the default cache.
|
|
68
|
+
"""
|
|
69
|
+
cache_names = options["cache_names"]
|
|
70
|
+
clear_all = options["clear_all"]
|
|
71
|
+
if clear_all:
|
|
72
|
+
self._clear_all_caches()
|
|
73
|
+
elif cache_names:
|
|
74
|
+
self._clear_individual_caches(cache_names)
|
|
75
|
+
else:
|
|
76
|
+
self._clear_default_cache()
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
__author__ = "Fabio Caccamo"
|
|
2
|
+
__copyright__ = "Copyright (c) 2024-present Fabio Caccamo"
|
|
3
|
+
__description__ = (
|
|
4
|
+
"clear the entire cache or individual caches easily "
|
|
5
|
+
"using the admin panel or management command."
|
|
6
|
+
)
|
|
7
|
+
__email__ = "fabio.caccamo@gmail.com"
|
|
8
|
+
__license__ = "MIT"
|
|
9
|
+
__title__ = "django-cache-cleaner"
|
|
10
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from django.db import migrations, models
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Migration(migrations.Migration):
|
|
5
|
+
initial = True
|
|
6
|
+
|
|
7
|
+
dependencies = []
|
|
8
|
+
|
|
9
|
+
operations = [
|
|
10
|
+
migrations.CreateModel(
|
|
11
|
+
name="Cache",
|
|
12
|
+
fields=[
|
|
13
|
+
(
|
|
14
|
+
"name",
|
|
15
|
+
models.CharField(
|
|
16
|
+
max_length=255,
|
|
17
|
+
primary_key=True,
|
|
18
|
+
serialize=False,
|
|
19
|
+
verbose_name="Name",
|
|
20
|
+
),
|
|
21
|
+
),
|
|
22
|
+
],
|
|
23
|
+
options={
|
|
24
|
+
"verbose_name": "Cache",
|
|
25
|
+
"verbose_name_plural": "Caches",
|
|
26
|
+
"ordering": ["name"],
|
|
27
|
+
},
|
|
28
|
+
),
|
|
29
|
+
]
|
|
File without changes
|
cache_cleaner/models.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from django.conf import settings
|
|
2
|
+
from django.db import models, transaction
|
|
3
|
+
from django.utils.translation import gettext_lazy as _
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Cache(models.Model):
|
|
7
|
+
class Meta:
|
|
8
|
+
ordering = ["name"]
|
|
9
|
+
verbose_name = _("Cache")
|
|
10
|
+
verbose_name_plural = _("Caches")
|
|
11
|
+
|
|
12
|
+
@classmethod
|
|
13
|
+
def update_from_settings(cls):
|
|
14
|
+
manager = cls.objects
|
|
15
|
+
settings_caches = set(settings.CACHES.keys())
|
|
16
|
+
existing_caches = set(manager.values_list("name", flat=True))
|
|
17
|
+
caches_to_create = settings_caches - existing_caches
|
|
18
|
+
caches_to_delete = existing_caches - settings_caches
|
|
19
|
+
|
|
20
|
+
with transaction.atomic():
|
|
21
|
+
if caches_to_create:
|
|
22
|
+
manager.bulk_create(
|
|
23
|
+
[Cache(name=cache_name) for cache_name in caches_to_create]
|
|
24
|
+
)
|
|
25
|
+
if caches_to_delete:
|
|
26
|
+
manager.filter(name__in=caches_to_delete).delete()
|
|
27
|
+
|
|
28
|
+
name = models.CharField(
|
|
29
|
+
verbose_name=_("Name"),
|
|
30
|
+
primary_key=True,
|
|
31
|
+
max_length=255,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
def __str__(self):
|
|
35
|
+
return f"{self.name}"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-present Fabio Caccamo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: django-cache-cleaner
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: clear the entire cache or individual caches easily using the admin panel or management command.
|
|
5
|
+
Author-email: Fabio Caccamo <fabio.caccamo@gmail.com>
|
|
6
|
+
Maintainer-email: Fabio Caccamo <fabio.caccamo@gmail.com>
|
|
7
|
+
License: MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2024-present Fabio Caccamo
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
|
|
29
|
+
Project-URL: Homepage, https://github.com/fabiocaccamo/django-cache-cleaner
|
|
30
|
+
Project-URL: Download, https://github.com/fabiocaccamo/django-cache-cleaner/releases
|
|
31
|
+
Project-URL: Documentation, https://github.com/fabiocaccamo/django-cache-cleaner#readme
|
|
32
|
+
Project-URL: Issues, https://github.com/fabiocaccamo/django-cache-cleaner/issues
|
|
33
|
+
Project-URL: Funding, https://github.com/sponsors/fabiocaccamo/
|
|
34
|
+
Project-URL: Twitter, https://twitter.com/fabiocaccamo
|
|
35
|
+
Keywords: django,cache,caches,cleaner,clear,clean,cleanup,command,management,purge
|
|
36
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
37
|
+
Classifier: Environment :: Web Environment
|
|
38
|
+
Classifier: Framework :: Django
|
|
39
|
+
Classifier: Framework :: Django :: 3.2
|
|
40
|
+
Classifier: Framework :: Django :: 4.0
|
|
41
|
+
Classifier: Framework :: Django :: 4.1
|
|
42
|
+
Classifier: Framework :: Django :: 4.2
|
|
43
|
+
Classifier: Framework :: Django :: 5.0
|
|
44
|
+
Classifier: Intended Audience :: Developers
|
|
45
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
46
|
+
Classifier: Natural Language :: English
|
|
47
|
+
Classifier: Operating System :: OS Independent
|
|
48
|
+
Classifier: Programming Language :: Python :: 3
|
|
49
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
50
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
51
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
52
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
53
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
54
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
55
|
+
Description-Content-Type: text/markdown
|
|
56
|
+
License-File: LICENSE.txt
|
|
57
|
+
|
|
58
|
+
[](https://www.python.org/)
|
|
59
|
+
[](https://www.djangoproject.com/)
|
|
60
|
+
|
|
61
|
+
[](https://pypi.org/project/django-cache-cleaner/)
|
|
62
|
+
[](https://pepy.tech/project/django-cache-cleaner)
|
|
63
|
+
[](https://github.com/fabiocaccamo/django-cache-cleaner/stargazers)
|
|
64
|
+
[](https://github.com/fabiocaccamo/django-cache-cleaner/blob/main/LICENSE.txt)
|
|
65
|
+
|
|
66
|
+
[](https://results.pre-commit.ci/latest/github/fabiocaccamo/django-cache-cleaner/main)
|
|
67
|
+
[](https://github.com/fabiocaccamo/django-cache-cleaner)
|
|
68
|
+
[](https://codecov.io/gh/fabiocaccamo/django-cache-cleaner)
|
|
69
|
+
<!-- [](https://www.codacy.com/app/fabiocaccamo/django-cache-cleaner) -->
|
|
70
|
+
[](https://codeclimate.com/github/fabiocaccamo/django-cache-cleaner/)
|
|
71
|
+
[](https://github.com/psf/black)
|
|
72
|
+
[](https://github.com/astral-sh/ruff)
|
|
73
|
+
|
|
74
|
+
# django-cache-cleaner
|
|
75
|
+
clear the entire cache or individual caches easily using the admin panel or management command.
|
|
76
|
+
|
|
77
|
+
## Installation
|
|
78
|
+
- Run `pip install django-cache-cleaner`
|
|
79
|
+
- Add `cache_cleaner` to `settings.INSTALLED_APPS`
|
|
80
|
+
- Run `python manage.py migrate`
|
|
81
|
+
- Restart your application server
|
|
82
|
+
|
|
83
|
+
## Usage
|
|
84
|
+
|
|
85
|
+
### Admin
|
|
86
|
+
To clear caches using the admin panel:
|
|
87
|
+
- โก๏ธ Navigate to the `Cache Cleaner / Caches`
|
|
88
|
+
- โ๏ธ Check the caches you want to clear
|
|
89
|
+
- ๐งน Select "Clear selected caches" from the actions menu
|
|
90
|
+
- โจ Done :)
|
|
91
|
+
|
|
92
|
+
### Command
|
|
93
|
+
This package doesn't need any setting.
|
|
94
|
+
|
|
95
|
+
#### Clear default cache
|
|
96
|
+
```python
|
|
97
|
+
python manage.py clear_cache
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
#### Clear individual caches
|
|
101
|
+
```python
|
|
102
|
+
python manage.py clear_cache news products
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
#### Clear all caches
|
|
106
|
+
```python
|
|
107
|
+
python manage.py clear_cache --all
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Testing
|
|
111
|
+
```bash
|
|
112
|
+
# clone repository
|
|
113
|
+
git clone https://github.com/fabiocaccamo/django-cache-cleaner.git && cd django-cache-cleaner
|
|
114
|
+
|
|
115
|
+
# create virtualenv and activate it
|
|
116
|
+
python -m venv venv && . venv/bin/activate
|
|
117
|
+
|
|
118
|
+
# upgrade pip
|
|
119
|
+
python -m pip install --upgrade pip
|
|
120
|
+
|
|
121
|
+
# install requirements
|
|
122
|
+
pip install -r requirements.txt -r requirements-test.txt
|
|
123
|
+
|
|
124
|
+
# install pre-commit to run formatters and linters
|
|
125
|
+
pre-commit install --install-hooks
|
|
126
|
+
|
|
127
|
+
# run tests
|
|
128
|
+
tox
|
|
129
|
+
# or
|
|
130
|
+
python runtests.py
|
|
131
|
+
# or
|
|
132
|
+
python -m django test --settings "tests.settings"
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
## License
|
|
137
|
+
Released under [MIT License](LICENSE.txt).
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Supporting
|
|
142
|
+
|
|
143
|
+
- :star: Star this project on [GitHub](https://github.com/fabiocaccamo/django-cache-cleaner)
|
|
144
|
+
- :octocat: Follow me on [GitHub](https://github.com/fabiocaccamo)
|
|
145
|
+
- :blue_heart: Follow me on [Twitter](https://twitter.com/fabiocaccamo)
|
|
146
|
+
- :moneybag: Sponsor me on [Github](https://github.com/sponsors/fabiocaccamo)
|
|
147
|
+
|
|
148
|
+
## See also
|
|
149
|
+
|
|
150
|
+
- [`django-admin-interface`](https://github.com/fabiocaccamo/django-admin-interface) - the default admin interface made customizable by the admin itself. popup windows replaced by modals. ๐ง โก
|
|
151
|
+
|
|
152
|
+
- [`django-colorfield`](https://github.com/fabiocaccamo/django-colorfield) - simple color field for models with a nice color-picker in the admin. ๐จ
|
|
153
|
+
|
|
154
|
+
- [`django-extra-settings`](https://github.com/fabiocaccamo/django-extra-settings) - config and manage typed extra settings using just the django admin. โ๏ธ
|
|
155
|
+
|
|
156
|
+
- [`django-maintenance-mode`](https://github.com/fabiocaccamo/django-maintenance-mode) - shows a 503 error page when maintenance-mode is on. ๐ง ๐ ๏ธ
|
|
157
|
+
|
|
158
|
+
- [`django-redirects`](https://github.com/fabiocaccamo/django-redirects) - redirects with full control. โช๏ธ
|
|
159
|
+
|
|
160
|
+
- [`django-treenode`](https://github.com/fabiocaccamo/django-treenode) - probably the best abstract model / admin for your tree based stuff. ๐ณ
|
|
161
|
+
|
|
162
|
+
- [`python-benedict`](https://github.com/fabiocaccamo/python-benedict) - dict subclass with keylist/keypath support, I/O shortcuts (base64, csv, json, pickle, plist, query-string, toml, xml, yaml) and many utilities. ๐
|
|
163
|
+
|
|
164
|
+
- [`python-codicefiscale`](https://github.com/fabiocaccamo/python-codicefiscale) - encode/decode Italian fiscal codes - codifica/decodifica del Codice Fiscale. ๐ฎ๐น ๐ณ
|
|
165
|
+
|
|
166
|
+
- [`python-fontbro`](https://github.com/fabiocaccamo/python-fontbro) - friendly font operations. ๐งข
|
|
167
|
+
|
|
168
|
+
- [`python-fsutil`](https://github.com/fabiocaccamo/python-fsutil) - file-system utilities for lazy devs. ๐งโโ๏ธ
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
cache_cleaner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
cache_cleaner/admin.py,sha256=dA-0HiXCXCNxCJ_-DsNQXYADaIwVTPzVpjKcgLyANkE,1126
|
|
3
|
+
cache_cleaner/apps.py,sha256=8uUbBOW9qq1G8H0SnC8UMedblBb1y7R5frODFjE2FkU,250
|
|
4
|
+
cache_cleaner/metadata.py,sha256=jeNSmocCFYD44Tr20BbxDn0utk1u2ONk5dq69LK2Hwo,334
|
|
5
|
+
cache_cleaner/models.py,sha256=XT6oJ1axCla-TMWjk1uRGQbDxNeCKfUTFA2gmf02gUw,1084
|
|
6
|
+
cache_cleaner/locale/en/LC_MESSAGES/django.mo,sha256=aQuJZjsNhY7crgdLLvHE4sk4jyqcYuy61rx6Y0ZikA4,588
|
|
7
|
+
cache_cleaner/locale/en/LC_MESSAGES/django.po,sha256=CHO0EvzD4rmLAAo6S79jD6RrPOzbwps5wg-tXdxte48,1011
|
|
8
|
+
cache_cleaner/locale/it/LC_MESSAGES/django.mo,sha256=44afawLpQ80g6qbXWBa0yVpE_FtLRvsv0-g8db3pITQ,588
|
|
9
|
+
cache_cleaner/locale/it/LC_MESSAGES/django.po,sha256=jaPDkTjowx74i7f9NvD3sommOvOQ_JxgfwrLE4eIUnk,1011
|
|
10
|
+
cache_cleaner/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
+
cache_cleaner/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
+
cache_cleaner/management/commands/clear_cache.py,sha256=5wH4OdzwWsyIe3s6mjXjV_dlpGDBrWObk-eIoHaCtPo,2539
|
|
13
|
+
cache_cleaner/migrations/0001_initial.py,sha256=1_5RU19RGIbsbLvY-msVRn_59aTaALBd8DmXWc7N2ZU,714
|
|
14
|
+
cache_cleaner/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
|
+
django_cache_cleaner-0.1.0.dist-info/LICENSE.txt,sha256=qrm28nhEZ93_njjhXRaNRgs3oTewj0nkG5M5OMF3Md4,1078
|
|
16
|
+
django_cache_cleaner-0.1.0.dist-info/METADATA,sha256=klcggWs9Lb6pSaqppS2_GAl7DT5_HOJidXrgkTnnBAg,8278
|
|
17
|
+
django_cache_cleaner-0.1.0.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
|
|
18
|
+
django_cache_cleaner-0.1.0.dist-info/top_level.txt,sha256=3xFKzYLYt69DmArlh6ty8Y-dNPag-bK7tz1WS6fL5z0,14
|
|
19
|
+
django_cache_cleaner-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cache_cleaner
|