I'd be keen for this as well. I first became aware of this table when running multiple instances of a CMS site which lead to me raising this issue; https://github.com/divio/django-cms/issues/6298
I can't think of a sane scenario which would need cache keys to be stored in the database. On Friday, 22 November 2019 11:09:08 UTC, Jacob Rief wrote: > > During my work on a faster implementation of the MenuRenderer, I came > across the model menu.models.MenuCache > <https://github.com/divio/django-cms/blob/develop/menus/models.py>. > This models in my opinion doesn't make any sense at all, and could be > dropped. It has been added in 2010 without > referring to any issue or pull request. The only possible explanation I > have found is this commit message: > "First try to have a process-safe caching mechanism for menu trees > <https://github.com/jrief/django-cms/commit/f193c4d1883845cbff0557385f430ada92ca792a> > ". > > A possible intention of this model could be to lock the cache 's bucket, > while some data is computed to be stored at it, so that > not more than one thread/process can for instance rebuild the menu tree. > If that's the original intention, then the current implementation > however does not work as expected, one would have to use SELECT FOR UPDATE > <https://docs.djangoproject.com/en/stable/ref/models/querysets/#select-for-update> > > to block the resource, ie. the chosen > cache-key. It's somehow weird, to use a relational database to block a > resource inside a memory cache. > > Another approach would be to use Distributed locks with Redis > <https://redis.io/topics/distlock>. There is a Python implementation > <https://github.com/SPSCommerce/redlock-py> for it, which however means > that we force django-CMS users to exclusively rely on Redis caching, > rather than say memcached or other caching mechanisms. > > Therefore my proposal is to completely drop that table and remove the code > using it. It just makes harm, with no evident benefit. > The worst scenario which could happen (but happens anyway), is that two > threads/processes compute the menu tree at the same > time and the later one *wins* in that sense, that it is *the* one which > writes its computed data to the cache. So, that's not a real problem. > > What do other core developers of django-CMS think about this proposal? > > – Jacob > -- Message URL: https://groups.google.com/d/msg/django-cms-developers/topic-id/message-id Unsubscribe: send a message to [email protected] --- You received this message because you are subscribed to the Google Groups "django CMS developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web, visit https://groups.google.com/d/msgid/django-cms-developers/3bab9aa2-1eac-4513-b449-69680c3fc024%40googlegroups.com.
