CLI way to clear data and tamplate cache

Description of issue or problem I’m having:
I’m looking for a CLI method to clear a journal’s data and template cache. Is there a tool to do this for OJS specifically, or is it a matter of clearing out the cache directory (without removing the cache directories themselves)?

Steps I took leading up to the issue:

What I tried to resolve the issue:
I’ve searched the OJS 3.2 documentation for clarification on this question.

Application Version - e.g., OJS 3.1.2:
OJS 3.2.1-4

1 Like

I do the following:

$ find /var/www/html/cache -type f -delete

@NateWr has a cool plugin in his repository that also does the job:


Thanks, @marc, for the quick reply! This would only apply to the template cache, right? If so, where might I clear out the data cache?


1 Like

I always though it will remove both… but @NateWr can answer this question for sure.

cacheBuster only clears the template and CSS cache:

Thanks for the clarification, @NateWr. Is there a relatively safe way to clear the data cache via the CLI?

@jrmitchell, this is the code that clears the data cache when you use the button on the admin page:

You could roll that into a CLI. Or I’d be open to receiving a PR on the cacheBuster plugin if you wanted to add that to the plugin.

@NateWr, it looks like it’s already in the cacheBuster plugin.

Am I misreading that?

@jrmitchell you’re right! My mistake. :laughing:

@NateWr No worries Thanks for sharing helping me out on this. I’ll definitely take a closer look at the CacheBuster plugin. Thanks also to @marc for sharing it initially and including you.

1 Like