openhab-core icon indicating copy to clipboard operation
openhab-core copied to clipboard

[rest] Add caching for add-on resource

Open florian-h05 opened this issue 1 year ago • 3 comments

As there are no registry listeners to use, I decided to listen to AddonEvents.

/cc @jimtng

florian-h05 avatar Feb 23 '24 09:02 florian-h05

No, I’m not sure.

Do you know a better way to detect changes?

florian-h05 avatar Mar 10 '24 14:03 florian-h05

The remote add-on services cache their content, too. The refresh time is 15 min, so I guess an automatic expiry of the cache with half of that would probably mitigate the issue.

J-N-K avatar Mar 10 '24 16:03 J-N-K

Thanks for the idea, I have just pushed that!

FYI I switched from having a CACHE_CONTROL constant on RESTConstants to having a default cache control getter on the RESTConstant class to migitate to risk that somewhere the const could be modified which would then apply to all places where the const is used.

florian-h05 avatar Mar 11 '24 22:03 florian-h05

@J-N-K Can you please have a look at this PR?

florian-h05 avatar Mar 23 '24 09:03 florian-h05

@J-N-K Done :+1:

Sign-Off is missing for the revert commit, hope that's okay. Otherwise I need to force push ...

florian-h05 avatar Mar 24 '24 20:03 florian-h05