-
Notifications
You must be signed in to change notification settings - Fork 54
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
feat: set fixed cache for active scenes and add all scenes getter #1829
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Lean Mendoza <[email protected]>
return cache.get(entityId) || fixedCache.get(entityId) | ||
}, | ||
set(entityId: string, entity: Entity | NotActiveEntity) { | ||
const isFixed = fixedCache.has(entityId) || (typeof entity !== 'string' && fixedTypes.includes(entity.type)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ain't the second part of the condition enough to use the fixedCache? (I mean if entity type is SCENE we should already store it regardless if it is already stored there, right?)
|
||
function getAllCachedScenes() { | ||
return Array.from(fixedCache.values()).filter( | ||
(entity): entity is Entity => typeof entity !== 'string' && entity.type === EntityType.SCENE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with this check, but can we prevent typeof entity !== string
on setting time instead of retrieve time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The LRU cache was already with this workaround for unsetting pointers with no longer active entities. I haven't had the intention of modifying this current behavior
This change introduces a handler to retrieve all the cached scenes. Also, the scene entities are pre-cached at the start and unaffected by the LRU logic.