berconpy.cache.RCONClientCache

class berconpy.cache.RCONClientCache

Bases: ABC

The base class for implementing caching.

Methods

add_connected_player(payload)

Adds a player to the cache after having connected.

add_missing_player(payload)

Adds a player that was missing from the cache.

get_player(player_id)

Looks up a player from cache using their server-given ID.

remove_player(player_id)

Invalidates a player in the cache.

set_player_guid(payload)

Sets the GUID of a cached player.

update_players(response)

Updates the cache by parsing a response to the "players" command.

verify_player_guid(payload)

Verifies the GUID of a cached player.

Attributes

admin_id

The RCON admin ID this client was given or None if the client has not logged in.

client

The client this cache is assigned to.

players

A list of players in the server.

abstract add_connected_player(payload)

Adds a player to the cache after having connected.

Return type:

Player

Returns:

The player that was created.

abstract add_missing_player(payload)

Adds a player that was missing from the cache.

Return type:

Player

Returns:

The player that was created.

abstract get_player(player_id)

Looks up a player from cache using their server-given ID.

Parameters:

player_id (int) – The ID of the player.

Return type:

Player | None

Returns:

The retrieved player or None if not found.

abstract remove_player(player_id)

Invalidates a player in the cache.

Return type:

Player | None

Returns:

The player that was removed, if any.

abstract set_player_guid(payload)

Sets the GUID of a cached player.

Return type:

Player | None

Returns:

The player that was updated, if any.

update_players(response)

Updates the cache by parsing a response to the “players” command.

Return type:

None

abstract verify_player_guid(payload)

Verifies the GUID of a cached player.

Return type:

Player | None

Returns:

The player that was updated, if any.

property admin_id: int | None

The RCON admin ID this client was given or None if the client has not logged in.

property client: RCONClient | None

The client this cache is assigned to.

abstract property players: Sequence[Player]

A list of players in the server.