nilsnolde / wordpress-markdown-git

:loop: WordPress plugin to add file content (Markdown, Jupyter notebooks) from a Git based VCS to a WordPress post; replaces https://github.com/gis-ops/md-github-wordpress
GNU General Public License v3.0
48 stars 14 forks source link

Removing cache_ttl does not flush cache #37

Closed ElDavoo closed 3 years ago

ElDavoo commented 3 years ago

Wordpress: 5.6 Documents for Git: 2.1.0

When you add the cache_ttl parameter to your markdown block and then you remove it, the plugin will only serve the last cached version of the document and will stop updating the document.

I didn't config anything

To Reproduce Steps to reproduce the behavior:

  1. Add a block: [git-gitlab-markdown user="" token="" url="" cache_ttl=""] to a wordpress page
  2. Fill it with valid parameters (i use a private repo)
  3. Save draft and preview.
  4. Remove the cache_ttl parameter.
  5. Update the document on Git{Lab,Hub}.
  6. Save draft and preview.

Expected behavior You should see the updated version

nilsnolde commented 3 years ago

as described in the readme, this is a static cache, meaning you need to give it a update interval with cache_ttl, the default is quite long, 1 week or so, not sure, didn't check. so if you don't provide a global config, that's what you'll get. if you set cache_ttl to 1 (either globally or per shortcode), then it'd update the source every second when someone visits your post.

unless you're trying to use jupyter notebooks, in which case it's a known problem but outside the scope of this project, see #26

nilsnolde commented 3 years ago

fwiw, dynamic caching (what you expect, update source, post will be updated) is already described in #20 and is looking for funding :)

ElDavoo commented 3 years ago

the default is quite long, 1 week or so

Nice ! So I got it wrong: It's not that the flush was not working, is that the default period was being used, as I though removing the cache_ttl would disable the cache completely instead of using the default. My bad!