A new FreshPorts features is being developed. I’m trying to determine if packages for a port can be cached separately from the port itself. I will explain.
When you visit a port page, if it’s not cached, the page is built and then cached. Not the whole page, just the parts pertaining to that port. The right hand column is not cached.
If you look at https://dev.freshports.org/editors/joe you’ll see a table listing the available packages, as shown here:
At present, this table is cached with the rest of the port information.
My thinking: ports and packages are updated independently. It would be nice/cool/pretty damn eloquent to cache them separately.
PROBLEM: The ports cache is static HTML. How do you toss another bit of static HTML into the middle of that?
How caching works
When an update to a port occurs, the cache for that port is cleared. The next web request for that port will repopulate that cache.
While generating the HTML for that port, if the package HTML is not found, it can also be generated.
However, packages and port are updated via separate mechanisms:
- port – via an incoming commit
- packages – a new package repo build appears
PROBLEM: the packages cache can disappear right after you look to see if it’s there; it’s a race condition.
It will be far easier to cache the packages for a port with the port itself. To do otherwise creates a mess of problems to solve.
This means each time a new repo is build, the entire ports cache must be cleared. That’s just a bunch of files on disk. mv * ../DELETEME/ && rm -rf ../DELETEME/ will fix that.
Any other ideas
Do you have any ideas? All welcome. Thank you.