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

Cache posts #4

Closed nilsnolde closed 4 years ago

nilsnolde commented 4 years ago

To avoid requesting the post from any platform even if nothing has changed since the last pull, the plugin should cache the posts. Use a HEAD request for this.

The logic to cache the post could be:

nilsnolde commented 4 years ago

Update: Gitlab doesn't send a last-modified header :roll_eyes: or anything related. So maybe the only option here would be to ask for the last commit and take the date out of there. A tiny little bit slower than for other providers, but still okish..

eblabs commented 4 years ago

Hi @nilsnolde , thanks again for your help.

About the caching, checking the document edits sounds like a great idea. Although as an intermediate step, would this simpler approach be possible?

Maybe this is something you're already doing.

Thanks!!

nilsnolde commented 4 years ago

Not even that much simpler I guess. Requesting a HEAD is not the more complicated thing to do IMO.

I think most of the work is researching how to best cache in WP, i.e. which directory to put them in or how (if) to flag that as cache, so it survives plugin & WP updates. Granted, that's not more than an hour. The rest is pretty straight-forward. I'd expect a day for this approx.

I'll take a look into this in a while, 1-2 months max. I don't consider it critical for most blogs. Can of course be sponsored money-wise, then I'd find time quicker;)

eblabs commented 4 years ago

Thanks @nilsnolde, sure I'd be happy to pitch in $$. Do you have a donation link or anything?

btw, I found a wordpress plugin that had a caching system that seemed to work well, it might be worth looking into for ideas. https://github.com/anytizer/hosted-content-importer.wp

nilsnolde commented 4 years ago

Yeah and there you got me.. I should set up smth like a donation link for us before slinging around things like that :wink: Thanks for the offer and the link. I'll dig in when I find the time.

nilsnolde commented 4 years ago

Quick shoutout @eblabs: #19 and @danilopinotti will implement static caching, merging and releasing soon. Wanted to let you know already, I'm kinda excited about this :smile: And sorry for the long wait

nilsnolde commented 4 years ago

Merged and v1.1.0 released to plugin repo :champagne:

eblabs commented 4 years ago

Thanks so much for the update @nilsnolde !! Really appreciate all your effort on this super handy plugin 👍