eclipse-langium / langium-website

Source of langium.org
https://langium.org/
MIT License
14 stars 34 forks source link

Recipe: Caches #241

Closed Lotes closed 1 week ago

Lotes commented 2 months ago

I added a recipe about the document cache. I am also mentioning the other caches (WorkspaceCache, ContextCache and SimpleCache).

I moved this recipe under the category "utilities". Maybe "performance" would be better?

github-actions[bot] commented 2 months ago

PR Preview Action v1.4.6 :---: Preview removed because the pull request was closed. 2024-09-04 15:31 UTC

Lotes commented 2 months ago

@msujew Can you tell me whether there is a common way in Langium to register the disposal of a cache? I explained the method, but have not shown any connection points with Langium.

msujew commented 1 month ago

@Lotes Given that the language server process lives and dies with its connection (and therefore also service container), any global caches (i.e. caches that live as part of a service implementation) are "disposed" as soon as the language server or its owning service container dies. They don't need to be explicitly registered for disposal.

Making these caches disposable was designed for cases in which the cache itself is designed to be short-lived. I assume these cases are fairly rare (we have none in our framework) and there's no recommended way of performing the disposal for now.

Lotes commented 2 weeks ago

Thanks, I added your suggestions, @msujew .