Commit graph

86 commits

Author SHA1 Message Date
Andrew Chen Wang
165cdb6a00
Add Django 3.2 Support and drop error dependency check (#181)
* Remove system check for Django version
* Closes #175
* Bump version and amend CHANGELOG
* Update with GitHub action CI
* Update README with Python and Django versions
* Limit Django version to 3.2, inclusively.
* Add note on Django constraints to README
* Bump minor version
* Justified by dropping support for dependency versions
* Drop support for Django 2.0-2.1, Python 3.5
* Change CI badge in README to GitHub actions
* Add support for Pymemcache for Django 3.2+
* Add Django 3.2 to test matrix
* Fix MySQL test_explain
* Allow filebased delta leniency in tests
* Allow Subquery in finding more Subqueries (Fixes #156)
* Reverts #157 with proper fix. The initial problem was due to `django.db.models.expressions.Subquery` allowing both QuerySet and sql.Query to be used.
* Fixes Django 3.2 test_subquery and test_invalidate_subquery testing by also checking the lhs
* Fix Django 2.2 Subquery having no query attr
* Fix filebased test time delta
* Fix test_invalidate_having due to new inner_query
* The new inner_query replaces subquery for Django 3.2 where subquery is now a boolean. That's why I initially used that TypeError in _get_tables_from_sql. inner_query looks to be a sql.Query
* Add PyMemcacheCache to supported cache backends

Co-authored-by: Dominik George <nik@naturalnet.de>
2021-05-13 00:27:14 -04:00
Dominik George
ac814e5cd4
Do not throw exception on externally invalidated cache keys (#169)
Closes #120
2021-03-21 19:27:16 -04:00
Andrew-Chen-Wang
d699c5b8c3 Squashed commit of the following:
commit 4a33e7b68196bf6e0ee0b7f942a992532495b616
Author: Andrew-Chen-Wang <acwangpython@gmail.com>
Date:   Mon Aug 10 16:04:26 2020 -0400

    Replace f-strings with join for Python 3.5

commit dcb33232d605c01025469e776c4ed8eb6ae0a326
Author: Andrew-Chen-Wang <acwangpython@gmail.com>
Date:   Mon Aug 10 15:55:09 2020 -0400

    Fix sql_flush for dj versions below 3.1
    * Removed any other instances of JSONField for Django 3.1 removed many things like JsonAdapter in favor of regular json module

commit 74195e9ff5a52dba2449a55e543a27ebd99e4fc9
Author: Andrew-Chen-Wang <acwangpython@gmail.com>
Date:   Mon Aug 10 09:17:03 2020 -0400

    Add Django 3.1 to Travis
    * Specify Django version when checking if JSONField exists

commit da5c1fa4c8b2f2efba0b12d7b27460c544e2473a
Author: Andrew-Chen-Wang <acwangpython@gmail.com>
Date:   Wed Aug 5 17:39:58 2020 -0400

    Added support for Django 3.1
    * Some fields were removed, others were deprecated. They are now in a list of deprecation to follow. Some new fields were added like PositiveBigIntegerField that won't be tested
    * monkey_patch.py has a try/except import for EmptyResultSet that was from archaic Django. Removed apparently due to compatibility issues
2020-08-10 16:49:46 -04:00
Andrew Chen Wang
f40a56dfe1
Add support for disabling cachalot (#158)
* This context manager allows for disabling cachalot using a context manager
* Allow for disabling all queries within context manager
2020-07-29 14:00:04 -04:00
Karthikeyan Singaravelan
6935629785
Fix warning regarding ABC import from collections (#160) 2020-07-26 13:30:47 -04:00
Andrew-Chen-Wang
6e22dc7f58 Drop Python 2.7 and Dj 1.11 2020-06-18 09:28:00 -04:00
Andrew-Chen-Wang
602cdcee1d
Version 2.2.0 (#146)
This PR upgrades cachalot to version 2.2.0 allowing for anyone to install cachalot at any Django package above 1.11. All tests currently function now.

* Added mysql as a service to fix Travis CI

* Removed tox dependency

* Removed upper limit on Django and support 2.2-3.0 CI Test
* Cachalot will only say "officially supports" while removing upper limit to not hinder anyone's progress.
* Added Python 3.8 and Django 2.2 and 3.0 to CI tests

- Max is 200 and we'll get there quickly if we add another Python version. Utilizes #127
- Keep dependencies for six and django.utils.six

* Correctly run Travis test by updating tox.ini
* Originally using tox syntax but changed testenv to travis so that travis env and travis dependencies and stuff are used

* Tox tests should start running command

* testenv without dependencies broke travis. New spot in Tox
* testenv without dependencies broke travis
* I can't figure out where testenv is supposed to be
* Good thing there's squash

* Added missing six in test
* Also added six package to Tox for Django 3.0 coverage.
* The missing six package caused several problems in several tests due to using an incorrect DB

* Resolves #138
* Need to add the panels here in order to satisfy tests

* Adds CachalotPanel to Python 2 backwards compatibility
* Forgot super class took those like save()

* Added databases to certain test cases
* APITestCase, DebugToolbarTestCase, SignalsTestCase required a database set
* Fixes errors like these: https://travis-ci.org/noripyt/django-cachalot/jobs/648691385#L4892

* Dropped OFFICIAL support for Python 3.4 + MySQL
* MySQL and its client on 3.4 is f--king up a lot of the testing and I can't bear with it. We can revisit it later, but, honestly, who uses Python 3.4... and if an organization is, then they will either have no problem with Postgres and SQLite or know that MySQL doesn't work.

* Drop Py3.4 from running. Fixed databases
* Now goes with setting's databases rather than hardcoded since some tests don't have other databases.

* Fix ReadTestCase

Django 2.2+ changed self.queryset at line 1000 with self.query=queryset.query

* Django Dependency Removed from utils.py

* Last commit used Django version. This one used try except

* Fixed assertNumQuery; added allow_failures for 3.4
* Primary: More information in test_utils.py with method is_django_21_below_and_is_sqlite
* The problem with the entire build lie in the self.is_sqlite for the tests. SQLite will make 2 queries when creating or destroying or updating instead of 1.
* In summary, if SQLite is the DB and Django

* Changed build matrix to allow failures for 3.4 instead of taking it out completely so that we can get it to work soon.

* Remove -> From function return
* I love backwards compatibility

* SQLite2 in multi_db.py returned incorrect bool

* Django 2.1 and SQLite checker doesn't work for some tests
* Some tests DO HAVE the BEGIN query that is returned... Not sure why. If the next test show completely different WriteTestCase problems, then we need to find alternative.
* Removed check from atomic

* Adjust Django and is_sqlite errors
* CI testing the Tox errors: https://travis-ci.org/noripyt/django-cachalot?utm_medium=notification&utm_source=github_status

* Adjust Django and is_sqlite errors (590 CI)
* CI testing the Tox errors: https://travis-ci.org/noripyt/django-cachalot?utm_medium=notification&utm_source=github_status
* Adjustment 2

* Make include matrix and Adjust Django and is_sqlite errors (594 CI)
* CI testing the Tox errors: https://travis-ci.org/noripyt/django-cachalot?utm_medium=notification&utm_source=github_status
* Adjustment 3

* Adjust Django and is_sqlite errors (596 CI)
* CI testing the Tox errors: https://travis-ci.org/noripyt/django-cachalot?utm_medium=notification&utm_source=github_status
* Adjustment 4
* Added my intro to ReadTheDocs

* Adjust Django and is_sqlite errors (598 CI)
* CI testing the Tox errors: https://travis-ci.org/noripyt/django-cachalot?utm_medium=notification&utm_source=github_status
* Adjustment 5

* Drop Python 3.4 from tests since PyLibMC not cooperating at that level.

* Bump package version up 1 minor for Django 2.2 and 3.0
2020-02-12 00:52:12 -05:00
Petr Dlouhý
782f00300e fixes for Django 3.0 (#144)
Use six since django.utils.six is dropped.
2020-02-09 23:05:06 -05:00
Bertrand Bordage
7581c7db0a Handles cases where cache values were tampered with. 2018-07-27 17:07:46 +02:00
Bertrand Bordage
6e429fdae3 Uses try…finally to fix #87 and avoid potentially similar issues. 2018-05-04 16:24:04 +02:00
Bertrand Bordage
9663754780 Uses a Python 2 version of wraps providing __wrapped__. 2017-06-07 10:17:58 +02:00
Bertrand Bordage
bc49fd18ea Multiple Python optimisations. 2017-06-07 08:59:35 +02:00
Bertrand Bordage
da4e21b515 Adds CACHALOT_DATABASES and removes dynamic setting support.
Dynamic setting support is removed because it’s not thread-safe.
2017-06-04 18:37:39 +02:00
Bertrand Bordage
b812f70895 Fixes an import on Django 1.8 2017-06-03 22:17:22 +02:00
Bertrand Bordage
84c53cd00d Invalidates queries on schema changes. 2017-06-03 22:02:23 +02:00
Bertrand Bordage
f6cfeb6226 Stops automatically invalidating other caches than CACHALOT_CACHE.
This had a negative impact on performance, and it was not working reliably.
It is clearer to invalidate only `CACHALOT_CACHE`, and to detail what
to do in the docs when we change `CACHALOT_CACHE`.
2016-09-29 19:11:21 +02:00
Bertrand Bordage
246873b42f Don’t invalidate uncachable queries. 2016-09-07 00:44:51 +02:00
Bertrand Bordage
571e6ec691 Adds CACHALOT_TIMEOUT. 2016-09-06 21:57:26 +02:00
Bertrand Bordage
0373f5eb60 Fixes the bytes → str conversion. 2016-07-21 23:59:11 +02:00
Ayzse
651a9bdf75 Unicode encode fix 2016-07-14 10:23:10 -05:00
Bertrand Bordage
58fd71c925 Small Python optimisations & simplifications. 2016-01-11 22:57:42 +01:00
Bertrand Bordage
7177361267 Avoids extra invalidations during write operations. 2015-10-28 11:37:58 +01:00
Bertrand Bordage
43bd5e1b38 Fixes the independence issue when nesting atomic block of different databases. 2015-10-26 02:42:13 +01:00
Bertrand Bordage
6c13636044 Creates get_last_invalidation(), while simplifying API usage. 2015-10-05 23:48:48 +02:00
Bertrand Bordage
abc00b1307 Merges invalidate_all, invalidate_tables and invalidate_models, while optimising it. 2015-10-05 22:31:47 +02:00
Bertrand Bordage
9938b54123 Merge branch 'master' into django-1.8
Conflicts:
	cachalot/cache.py
	cachalot/monkey_patch.py
	cachalot/tests/read.py
	cachalot/utils.py
	tox.ini
2015-10-02 18:39:04 +02:00
Bertrand Bordage
d9259802fa Fixes an issue with MySQL. 2015-06-19 18:06:20 +02:00
Bertrand Bordage
7f86cfe1cc Python optimisations. 2015-06-18 03:07:04 +02:00
Bertrand Bordage
d9e19a8ca5 Simplifications. 2015-06-17 22:39:39 +02:00
Bertrand Bordage
5cc4d3ae93 Adds an UNCACHABLE_TABLES setting to fix some migrations issues in tests and significantly speed up tests. 2015-06-17 21:24:49 +02:00
Bertrand Bordage
a32f86ffb4 Optimizes automatic invalidation. 2015-05-24 19:34:24 +02:00
Bertrand Bordage
720480359b Stops caching queries with random subqueries. 2015-05-24 19:29:50 +02:00
Bertrand Bordage
16e14c9219 Drops Django 1.6 & Python 2.6 support. 2015-04-11 01:57:13 +02:00
Bertrand Bordage
352fb2d829 Small Python optimizations.
While keeping code compatible with Python 2.6 to 3.4, of course…
2015-01-03 06:38:16 +01:00
Bertrand Bordage
becfab3791 Removes lines that became useless. 2014-12-14 08:35:52 +01:00
Bertrand Bordage
a4805f1e47 Fixes the set_many. 2014-12-13 19:13:22 +01:00
Bertrand Bordage
603e018073 Uses set_many instead of multiple adds. 2014-12-13 19:05:12 +01:00
Bertrand Bordage
a358fc18a9 Removes a cache.clear() accidentally introduced. 2014-12-09 01:35:42 +01:00
Bertrand Bordage
859337072e Unnests some code & handles unexpected None found in cache with memcached. 2014-12-07 07:04:26 +01:00
Bertrand Bordage
984b3f2530 Invalidates executemany. 2014-12-07 02:44:50 +01:00
Bertrand Bordage
c09d95e301 Replaces del dict[k] by dict.pop(k). 2014-11-24 18:41:35 +01:00
Bertrand Bordage
45e4cd543b Rewrites invalidation for a better speed & memory performance. 2014-11-24 12:05:00 +01:00
Bertrand Bordage
cf53a6e683 Makes sure a cache key wasn’t invalidated in the meantime. 2014-11-20 14:33:26 +01:00
Bertrand Bordage
680cbc61d0 Stops pickling results for performance and security reasons. 2014-11-19 21:51:04 +01:00
Bertrand Bordage
fbef9448b9 Fixes Django 1.6. 2014-11-04 01:38:51 +01:00
Bertrand Bordage
6200a12b20 Invalidates raw queries. 2014-11-04 01:17:35 +01:00
Bertrand Bordage
83618b69cd Adds QUERY_KEYGEN & TABLE_KEYGEN. 2014-10-30 04:17:48 +01:00
Bertrand Bordage
ddfbfba75d Caches all queries resulting of a `Queryset.extra`. 2014-10-29 19:38:33 +01:00
Bertrand Bordage
d34b92f2a8 Removes redundant patches. 2014-10-29 18:19:00 +01:00
Bertrand Bordage
5f94747ae6 Adds CACHALOT_CACHE_RANDOM. 2014-10-29 17:50:36 +01:00