node-steam-user icon indicating copy to clipboard operation
node-steam-user copied to clipboard

Add clearPicsCache function to reduce memory usage and store job types

Open 3urobeat opened this issue 2 years ago • 2 comments

This PR adds a clearPicsCache() function to reduce memory usage if content is not needed anymore.

In order for the garbage collector to instantly free the memory being used we need to filter the jobs object.
I added a type property to every jobs entry which stores the EMsg value of the associated request. This allows us to only filter PICS related entries instead of needing to nuke the whole object.

Related forum thread: https://dev.doctormckay.com/topic/4476-advice-needed-on-clearing-picscache-im-struggling-with-ram-usage/

Note: I updated the documentation but I didn't fill out the required version as I don't know which version number you'll choose

3urobeat avatar Jun 26 '23 12:06 3urobeat

If your use-case is simply that you need to know which apps you own, I'd rather come up with a better way of determining that without needing to enable the entire pics cache.

DoctorMcKay avatar Jun 27 '23 04:06 DoctorMcKay

If there is a better way of determining the owned apps then I'll look into it, thanks
But I still think having a function to clear the pics cache if needed would be a good feature

Edit: I completely overlooked that getUserOwnedApps() exists, does the job and doesn't need the picsCache

3urobeat avatar Jun 27 '23 08:06 3urobeat