Skip to content

Method to cleanup/disconnect cached queries #300

@PepeElToro41

Description

@PepeElToro41

Describe your Feature

Have a way to cleanup a cached query. Usage for UI hooks in vide/react. They sometimes need to reiterate a query, so the query needs to be up-to-date. This is only possible with cached queries but they cant be cleaned up.

Implementation

Cached queries would have a query:cleanup() method that would disconnect the query so it no longer listens for archetype creation and doesnt take up memory.

Alternatives

Having a way to force a non-cached query to rematch archetypes. This way a query can be forced to be up to date without requiring a cached query. Hooks could also receive a function that creates the query, and recreate it everytime they need it.

Considerations

Some questions that need to be answered include the following:

  • Will old code break in response to this feature?:
    No.
  • What are the performance impacts with this feature (if any)?:
    None if you dont use the method
  • How is it useful to include?:
    Useful for hooks, and to have semi-dynamic cached queries: like one query per player, that would stay as long as the player is in the server.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions