Jump to content
McKay Development

Recommended Posts

Posted
Good evening.


I noticed that user data is cached.


For example:



community.getSteamUser(steamID), (err, user) => {
    console.log(user.groups);
});


Will output the same data until I restarted the bot.

Is there a way to disable this cache ?

  • 4 years later...
Posted

I had this problem.

Data from pages like https://steamcommunity.com/profiles/76561198054394425/?xml=1 are cached both in a regular browser and in nodeJS. And as a result, the function getSteamUser can return old data.

I don't know how to disable caching in nodeJS.

I used quite simply another solution.

\node_modules\steamcommunity\classes\CSteamUser.js

Quote

this.httpRequest("http://steamcommunity.com/" + (typeof id === 'string' ? "id/" + id : "profiles/" + id.toString()) + "/?xml=1&random=" + Date.now(), function(err, response, body) {

 

Tests:

            community.getSteamUser(new SteamID("76561198125730690"), (error, user) => {
                if (error) {
                    console.log(error)
                } else {
                    console.log(user.privacyState)
                }
            })

Results, without fix:

public
// Here I make the profile private
public

 

With fix:
private
// Here I make the profile public
public
// Here I make the profile for friends only
friendsonly

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...