Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cache] Change implementation to the new access-tracking cache in core #184

Closed
florian-h05 opened this issue Dec 2, 2022 · 2 comments · Fixed by #191
Closed

[cache] Change implementation to the new access-tracking cache in core #184

florian-h05 opened this issue Dec 2, 2022 · 2 comments · Fixed by #191
Assignees
Labels
enhancement New feature or request

Comments

@florian-h05
Copy link
Contributor

florian-h05 commented Dec 2, 2022

With the addition of both a privateCache (per script identifier, useful for sharing timers) and a sharedCache (shared across all scripts from all languages) in openhab/openhab-core#2887, we have to update our implementation of cache.

Backward compatibility must be kept!!

After we have a solution here, we can remove the SharedCache from JS Scripting.

My proposal is:

  • for the current methods of cache:
    • check if the new caches from core are available
    • if they are available, log a deprecation warning and use the shared cache from core instead of the addon‘s shared cache implementation so that we can remove SharedCache from the addon
    • if they are not available (means the library runs on an „old“ openHAB version), do nothing and keep the current behaviour
  • add a private property to cache to allow access to the private cache
  • add a shared property to cache to allow access to the shared cache

@rkoshak @digitaldan @jpg0 WDYT?

@florian-h05 florian-h05 added the enhancement New feature or request label Dec 2, 2022
@florian-h05 florian-h05 self-assigned this Dec 2, 2022
@florian-h05
Copy link
Contributor Author

@wborn FYI: Before removing the SharedCache from the JS Scripting add-on, we/I have to change the implementation of the cache in the helper library.

@rkoshak
Copy link
Contributor

rkoshak commented Dec 3, 2022

Sounds good to me.

@openhab openhab deleted a comment from rkoshak Dec 3, 2022
florian-h05 added a commit that referenced this issue Dec 11, 2022
Fixes #184.

* [cache] Change implementation to the core caches
... while keeping backward compatibility with older openHAB versions by providing a legacy mode using the addon provided „sharedcache“.
* [cache] Improve logging
* [test] Test JSCache instead of exported methods
* README: Explain private & shared caches
* [cache] Update type definitions
* Update CHANGELOG
* README: Mention automatic cancellation of timers in cache
* [cache] Add timer cancellation note to JSDoc

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants