Skip to content

Commit

Permalink
v2.3.3
Browse files Browse the repository at this point in the history
* Fix a comment block disabling incorrectly RST form for cachalot_disabled
* Update CHANGELOG.rst
* Several points did I incorrectly say that 50 modifications per second was too much. It was supposed to say minute. You'd have to have a LARGE website to really get to that point since inserts from an external DB would typically take a 250-1000ms/1s per INSERT/UPDATE
* Add Python 3.9 support in the docs and setup.py
* Move chat to Discord and reflect in the docs
  • Loading branch information
Andrew-Chen-Wang committed Nov 9, 2020
1 parent e41150a commit d0b5213
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 12 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -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
-----

Expand Down Expand Up @@ -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
Expand Down
17 changes: 10 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

----

Expand All @@ -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
-----
Expand Down Expand Up @@ -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
Expand All @@ -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.

Expand All @@ -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 <https://join.slack.com/t/cachalotdjango/shared_invite/zt-dd0tj27b-cIH6VlaSOjAWnTG~II5~qw>`_.
Help? Technical chat? `It's here on Discord <https://discord.gg/WFGFBk8rSU>`_.

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

Expand Down
2 changes: 1 addition & 1 deletion cachalot/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = (2, 3, 2)
VERSION = (2, 3, 3)
__version__ = '.'.join(map(str, VERSION))

default_app_config = 'cachalot.apps.CachalotConfig'
21 changes: 12 additions & 9 deletions cachalot/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
.....
Expand Down Expand Up @@ -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
Expand All @@ -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 <https://github.com/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.

Expand Down
4 changes: 2 additions & 2 deletions docs/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <Benchmark>`).
Expand Down
2 changes: 1 addition & 1 deletion docs/limits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <Introduction>` for more details.
Expand Down
2 changes: 1 addition & 1 deletion docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/niwinz/django-redis>`_
Expand Down
4 changes: 2 additions & 2 deletions docs/reporting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ Bug reports, questions, discussion, new features
`on GitHub <https://github.com/noripyt/django-cachalot/issues>`_
- If you have **a question** on how django-cachalot works
or to **simply discuss**,
`chat with us on Slack <https://join.slack.com/t/cachalotdjango/shared_invite/zt-dd0tj27b-cIH6VlaSOjAWnTG~II5~qw>`_.
`chat with us on Discord <https://discord.gg/WFGFBk8rSU>`_.
- If you want **to add a feature**:

- if you have an idea on how to implement it, you can fork the project
and send a pull request, but **please open an issue first**, because
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 <https://join.slack.com/t/cachalotdjango/shared_invite/zt-dd0tj27b-cIH6VlaSOjAWnTG~II5~qw>`_ first
`ask on Discord <https://discord.gg/WFGFBk8rSU>`_ first
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit d0b5213

Please sign in to comment.