How to clear Mayan cache from CLI?

Technical aspects, customization, code samples.
Post Reply
JeremyD
Posts: 1
Joined: Thu Sep 17, 2020 1:30 am

How to clear Mayan cache from CLI?

Post by JeremyD »

I'm hoping that it is possible to clear the Maya-EDMS cache via the commandline. I.e. do the same thing as clearing/purging the caches via the Admin UI.

If anyone has any ideas, please share.

Thanks.
User avatar
rosarior
Developer
Developer
Posts: 688
Joined: Tue Aug 21, 2018 3:28 am
Location: Puerto Rico
Contact:

Re: How to clear Mayan cache from CLI?

Post by rosarior »

Not at the moment but it is a planned feature like we did for purging stale locks and stale permissions after an upgrade.

For now the solution is to open a shell and do it in Python.

Code: Select all

/opt/mayan-edms/bin/mayan-edms.py shell
Then in the Python shell:

Code: Select all

from mayan.apps.file_caching.models import Cache
[cache.purge() for cache in Cache.objects.all()]
Give this a try.

Best regards.
Post Reply