diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index 21283b13d..5593a6bba 100644 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/ISSUE_TEMPLATE/question.md @@ -1,6 +1,6 @@ --- name: Question -about: Ask a generic/specific question here or on the Slack chat +about: Ask a generic/specific question here or on the Discord chat --- ## Question diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ccf8a166e..a7a0f97e8 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,15 @@ What’s new in django-cachalot? ============================== +2.3.3 +----- + +- Remove deprecated signal argument (#165) +- Add Python 3.9 support +- Use Discord instead since Slack doesn't save messages, + @Andrew-Chen-Wang is not on there very much, and Discord + has a phenomenal search functionality (with ES). + 2.3.2 ----- @@ -28,7 +37,9 @@ What’s new in django-cachalot? - Adds Django 2.2 and 3.0 support. - Dropped official support for Python 3.4 - - It won't run properly with Travis CI tests on MySQL. + + - It won't run properly with Travis CI tests on MySQL. + - All Travis CI tests are fully functional. 2.1.0 diff --git a/README.rst b/README.rst index 94db46372..aacb561ac 100644 --- a/README.rst +++ b/README.rst @@ -22,8 +22,8 @@ Documentation: http://django-cachalot.readthedocs.io .. image:: http://img.shields.io/scrutinizer/g/noripyt/django-cachalot/master.svg?style=flat-square&maxAge=3600 :target: https://scrutinizer-ci.com/g/noripyt/django-cachalot/ -.. image:: https://img.shields.io/badge/cachalot-Chat%20on%20Slack-green?style=flat&logo=slack - :target: https://join.slack.com/t/cachalotdjango/shared_invite/zt-dd0tj27b-cIH6VlaSOjAWnTG~II5~qw +.. image:: https://img.shields.io/discord/773656139207802881 + :target: https://discord.gg/WFGFBk8rSU ---- @@ -39,7 +39,7 @@ Table of Contents: Quickstart ---------- -Cachalot officially supports Python 3.5-3.8 and Django 2.0-2.2, 3.0-3.1 with the databases PostgreSQL, SQLite, and MySQL. +Cachalot officially supports Python 3.5-3.9 and Django 2.0-2.2, 3.0-3.1 with the databases PostgreSQL, SQLite, and MySQL. Usage ----- @@ -99,7 +99,7 @@ Third-Party Cache Comparison There are three main third party caches: cachalot, cache-machine, and cache-ops. Which do you use? We suggest a mix: -TL;DR Use cachalot for cold or modified <50 times per seconds (Most people should stick with only cachalot since you +TL;DR Use cachalot for cold or modified <50 times per minutes (Most people should stick with only cachalot since you most likely won't need to scale to the point of needing cache-machine added to the bowl). If you're an enterprise that already has huge statistics, then mixing cold caches for cachalot and your hot caches with cache-machine is the best mix. However, when performing joins with ``select_related`` and ``prefetch_related``, you can @@ -113,7 +113,7 @@ Cachalot is more-or-less intended for cold caches or "just-right" conditions. If Django (also authored but work-in-progress by `Andrew Chen Wang`_), then the caching will work better since sharding the cold/accessed-the-least records aren't invalidated as much. -Cachalot is good when there are <50 modifications per second on a hot cached table. This is mostly due to cache invalidation. It's the same with any cache, +Cachalot is good when there are <50 modifications per minute on a hot cached table. This is mostly due to cache invalidation. It's the same with any cache, which is why we suggest you use cache-machine for hot caches. Cache-machine caches individual objects, taking up more in the memory store but invalidates those individual objects instead of the entire table like cachalot. @@ -129,9 +129,12 @@ Note 2: Technical comparison: https://django-cachalot.readthedocs.io/en/latest/i Discussion ---------- -Help? Technical chat? `It's here on Slack `_. +Help? Technical chat? `It's here on Discord `_. -Legacy chat: https://gitter.im/django-cachalot/Lobby +Legacy chats: + +- https://gitter.im/django-cachalot/Lobby +- https://join.slack.com/t/cachalotdjango/shared_invite/zt-dd0tj27b-cIH6VlaSOjAWnTG~II5~qw .. _Andrew Chen Wang: https://github.com/Andrew-Chen-Wang diff --git a/cachalot/__init__.py b/cachalot/__init__.py index e94df5a1e..8b0239a4b 100644 --- a/cachalot/__init__.py +++ b/cachalot/__init__.py @@ -1,4 +1,4 @@ -VERSION = (2, 3, 2) +VERSION = (2, 3, 3) __version__ = '.'.join(map(str, VERSION)) default_app_config = 'cachalot.apps.CachalotConfig' diff --git a/cachalot/api.py b/cachalot/api.py index c64511cff..54584442f 100644 --- a/cachalot/api.py +++ b/cachalot/api.py @@ -142,15 +142,18 @@ def cachalot_disabled(all_queries=False): the variable that saved it in-memory. For example: - with cachalot_disabled(): - qs = Test.objects.filter(blah=blah) - # Does a single query to the db - list(qs) # Evaluates queryset - # Because the qs was evaluated, it's - # saved in memory: - list(qs) # this does 0 queries. - # This does 1 query to the db - list(Test.objects.filter(blah=blah)) + + .. code-block:: python + + with cachalot_disabled(): + qs = Test.objects.filter(blah=blah) + # Does a single query to the db + list(qs) # Evaluates queryset + # Because the qs was evaluated, it's + # saved in memory: + list(qs) # this does 0 queries. + # This does 1 query to the db + list(Test.objects.filter(blah=blah)) If you evaluate the queryset outside the context manager, any duplicate query will use the cached result unless an object creation happens in between diff --git a/docs/index.rst b/docs/index.rst index 4e7583ca9..fedf53f7d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -20,8 +20,8 @@ Caches your Django ORM queries and automatically invalidates them. .. image:: http://img.shields.io/scrutinizer/g/noripyt/django-cachalot/master.svg?style=flat-square&maxAge=3600 :target: https://scrutinizer-ci.com/g/noripyt/django-cachalot/ -.. image:: https://img.shields.io/badge/cachalot-Chat%20on%20Slack-green?style=flat&logo=slack - :target: https://join.slack.com/t/cachalotdjango/shared_invite/zt-dd0tj27b-cIH6VlaSOjAWnTG~II5~qw +.. image:: https://img.shields.io/discord/773656139207802881 + :target: https://discord.gg/WFGFBk8rSU Usage ..... @@ -64,7 +64,7 @@ In-depth opinion (from new maintainer): There are three main third party caches: cachalot, cache-machine, and cache-ops. Which do you use? We suggest a mix: -TL;DR Use cachalot for cold or modified <50 times per seconds (Most people should stick with only cachalot since you +TL;DR Use cachalot for cold or modified <50 times per minutes (Most people should stick with only cachalot since you most likely won't need to scale to the point of needing cache-machine added to the bowl). If you're an enterprise that already has huge statistics, then mixing cold caches for cachalot and your hot caches with cache-machine is the best mix. However, when performing joins with select_related and prefetch_related, you can @@ -78,7 +78,7 @@ Cachalot is more-or-less intended for cold caches or "just-right" conditions. If Django (also authored but work-in-progress by `Andrew Chen Wang `_), then the caching will work better since sharding the cold/accessed-the-least records aren't invalidated as much. -Cachalot is good when there are <50 modifications per second on a hot cached table. This is mostly due to cache invalidation. It's the same with any cache, +Cachalot is good when there are <50 modifications per minute on a hot cached table. This is mostly due to cache invalidation. It's the same with any cache, which is why we suggest you use cache-machine for hot caches. Cache-machine caches individual objects, taking up more in the memory store but invalidates those individual objects instead of the entire table like cachalot. diff --git a/docs/introduction.rst b/docs/introduction.rst index 9ea8173f4..3d255c5f6 100644 --- a/docs/introduction.rst +++ b/docs/introduction.rst @@ -17,8 +17,8 @@ if you need to be convinced). One of the best suited is ``select_related`` and ``prefetch_related`` operations. However, it’s not suited for projects where there is **a high number -of modifications per second** on each table, like a social network with -more than a 50 messages per second. Django-cachalot may still give a small +of modifications per minute** on each table, like a social network with +more than a 50 messages per minute. Django-cachalot may still give a small speedup in such cases, but it may also slow things a bit (in the worst case scenario, a 20% slowdown, according to :ref:`the benchmark `). diff --git a/docs/limits.rst b/docs/limits.rst index 5e1ce5798..356384efe 100644 --- a/docs/limits.rst +++ b/docs/limits.rst @@ -7,7 +7,7 @@ High rate of database modifications ................................... Do not use django-cachalot if your project has more than 50 database -modifications per second on most of its tables. There will be no problem, +modifications per minute on most of its tables. There will be no problem, but django-cachalot will become inefficient and will end up slowing your project instead of speeding it. Read :ref:`the introduction ` for more details. diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 09a5e392f..bf4aeb1ed 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -5,7 +5,7 @@ Requirements ............ - Django 2.0-2.2, 3.0-3.1 -- Python 3.5-3.8 +- Python 3.5-3.9 - a cache configured as ``'default'`` with one of these backends: - `django-redis `_ diff --git a/docs/reporting.rst b/docs/reporting.rst index 727cba596..bcf515849 100644 --- a/docs/reporting.rst +++ b/docs/reporting.rst @@ -7,7 +7,7 @@ Bug reports, questions, discussion, new features `on GitHub `_ - If you have **a question** on how django-cachalot works or to **simply discuss**, - `chat with us on Slack `_. + `chat with us on Discord `_. - If you want **to add a feature**: - if you have an idea on how to implement it, you can fork the project @@ -15,4 +15,4 @@ Bug reports, questions, discussion, new features someone else could already be working on it - if you’re sure that it’s a must-have feature, open an issue - if it’s just a vague idea, please - `ask on Slack `_ first + `ask on Discord `_ first diff --git a/setup.py b/setup.py index e6e79a9a2..240aa1ede 100755 --- a/setup.py +++ b/setup.py @@ -36,6 +36,7 @@ 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', 'Topic :: Internet :: WWW/HTTP', ], license='BSD',