Skip to content

Conversation

@abeforgit
Copy link

@abeforgit abeforgit commented Oct 27, 2020

While it is definitely a good idea to stress the importance of a good cache setup, the current docs make it sound like it won't work at all without, which doesn't seem to be the case. For quick tests and small-scale projects it is good to know that it will run fine without.
Closes #11

@solarissmoke
Copy link

solarissmoke commented Nov 9, 2020

I think the assertion that a cache isn't required is false. You can verify this by running with the cache entirely disabled (i.e., use the Django DummyCache) as a backend: it will not work at all. This bit of code will always raise a 404 error because there is never anything in the cache.

The code is not only assuming the presence of a cache, but of a persistent cache that never culls anything. This was alluded to in this issue, where the conversation didn't go so well, but I think the original point is valid: it's very easy to break a widget just because it's cache entry was removed for any reason. This is easy to demonstrate with the LocMemCache in development - just restarting the Django server while using a widget on a page is sufficient to make it stop working.

@jpm92
Copy link

jpm92 commented Nov 9, 2020

I think the assertion that a cache isn't required is false. You can verify this by running with the cache entirely disabled (i.e., use the Django DummyCache) as a backend: it will not work at all. This bit of code will always raise a 404 error because there is never anything in the cache.

The code is not only assuming the presence of a cache, but of a persistent cache that never culls anything. This was alluded to in this issue, where the conversation didn't go so well, but I think the original point is valid: it's very easy to break a widget just because it's cache entry was removed for any reason. This is easy to demonstrate with the LocMemCache in development - just restarting the Django server while using a widget on a page is sufficient to make it stop working.

Well, I'm using it at the moment with the default django cache and I facing no issues so far...

@abeforgit
Copy link
Author

Im using the default cache (which from the django docs I gather is the LocMemCache), which is also not persistent, with no issues.
Sure maybe it's not the best thing to do and definitely not for a heavy-use production app, but how many of us came here to just get a working select with the least amount of setup for their 5-user demo app?

Copy link
Owner

@codingjoe codingjoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me thanks @abeforgit

Copy link
Owner

@codingjoe codingjoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, actually it doesn't work for me. The cache needs to be persistent, not matter the setup. If you use a single app node setup, of course you don't need a cache that is persistent across mutliple nodes, thus LocMemCache would do.

The paragraph was introduced because I got many people reporting problems because they forgot to set up a persistent cache. I know it makes initial set up a little harder, but I don't see a way around it.

@codingjoe
Copy link
Owner

codingjoe commented Dec 15, 2020

That being said, I welcome changes on the docs and this paragraph too. Maybe you can rewrite it a little be more comprehensive.

@abeforgit
Copy link
Author

Ah I think that is indeed the source of most of the confusion. Ill rewrite it sometime this week, hopefully tomorrow

@codecov
Copy link

codecov bot commented Apr 18, 2021

Codecov Report

❗ No coverage uploaded for pull request base (master@038026c). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@ ## master #16 +/- ## ========================================= Coverage ? 99.58% ========================================= Files ? 7 Lines ? 240 Branches ? 0 ========================================= Hits ? 239 Misses ? 1 Partials ? 0 

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 038026c...d7da050. Read the comment docs.

@abeforgit
Copy link
Author

"Tomorrow" turned out to be about 4 months later... funny how that goes...

Copy link
Owner

@codingjoe codingjoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @abeforgit,

Excellent addition to the docs! Good documentation is key. Great contribution.

Best,
Joe

@codingjoe codingjoe merged commit fcd825d into codingjoe:master Apr 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants