Skip to content

Commit

Permalink
Eliminate references to removed Ps2Object.get() helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
leonhard-s committed Jul 16, 2023
1 parent f2a5620 commit 1778421
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 26 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ See the [Caching](#caching) section for details on the caching system.

#### Named Objects

Named objects are based off the `Named` class and always cached. This base class guarantees a `.name`] attribute and allows the use of the [`.get_by_name()`](https://auraxium.readthedocs.io/en/latest/api/rest.html#auraxium.base.Named.get_by_name) method, which is also cached.
Named objects are based off the `Named` class and always cached. This base class guarantees a `.name` attribute and allows the use of the [`.get_by_name()`](https://auraxium.readthedocs.io/en/latest/api/rest.html#auraxium.Client.get_by_name) method, which is also cached.

This caching strategy is almost identical to the one used for IDs, except that it uses a string constructed of the lower-case name and locale identifier to store objects (e.g. `'en_sunderer'`).

Expand Down
4 changes: 2 additions & 2 deletions auraxium/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ class Named(Cached, cache_size=0, cache_ttu=0.0, metaclass=abc.ABCMeta):
This extends the functionality provided by
:class:`~auraxium.base.Cached` to also cache objects retrieved via
:meth:`Named.get_by_name`. The cache will also store the locale
used for the request.
:meth:`~auraxium.Client.get_by_name`. The cache will also store the
locale used for the request.
"""

_cache: ClassVar[TLRUCache[int | str, Any]] # type: ignore
Expand Down
10 changes: 0 additions & 10 deletions docs/api/ps2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ Player Characters

.. automethod:: friends() -> list[Character]

.. automethod:: get_by_name(name: str, *, locale: str = 'en', client: auraxium.Client) -> typing.Awaitable[Character | None]

.. automethod:: get_online(id_: int, *args: int, client: auraxium.Client) -> list[Character]

.. automethod:: items() -> auraxium.SequenceProxy[Item]
Expand Down Expand Up @@ -80,10 +78,6 @@ Outfits

.. automethod:: tag() -> str

.. automethod:: get_by_name(name: str, *, locale: str = 'en', client: auraxium.Client) -> typing.Awaitable[Outfit | None]

.. automethod:: get_by_tag(tag: str, client: auraxium.Client) -> typing.Awaitable[Outfit | None]

.. automethod:: leader() -> auraxium.InstanceProxy[OutfitMember]

.. automethod:: members() -> auraxium.SequenceProxy[OutfitMember]
Expand Down Expand Up @@ -111,8 +105,6 @@ Game World & Servers

.. automethod:: events(**kwargs: Any) -> list[auraxium.types.CensusData]

.. automethod:: get_by_name(name: str, *, locale: str = 'en', client: auraxium.Client) -> typing.Awaitable[World | None]

.. automethod:: map(zone: int | Zone, *args: int | Zone) -> list[auraxium.types.CensusData]

.. automethod:: status() -> tuple[str, datetime.datetime]
Expand Down Expand Up @@ -225,8 +217,6 @@ Items & Weapons

.. automethod:: fire_groups() -> auraxium.SequenceProxy[FireGroup]

.. automethod:: get_by_name(name: str, *, locale: str = 'en', client: auraxium.Client) -> typing.Awaitable[Weapon | None]

.. automethod:: item() -> auraxium.InstanceProxy[Item]

Map Screen
Expand Down
12 changes: 0 additions & 12 deletions docs/api/rest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,14 @@ Object Model Bases

.. autoclass:: Ps2Object

.. automethod:: count(client: auraxium.Client, **kwargs) -> int

.. automethod:: find(results: int = 10, *, offset: int = 0, promote_exact: bool = False, check_case: bool = True, client: auraxium.Client, **kwargs) -> list[Ps2Object]

.. automethod:: get(client: auraxium.Client, check_case: bool = True, **kwargs) -> Ps2Object | None

.. automethod:: get_by_id(id_: int, *, client: auraxium.Client) -> Ps2Object | None

.. automethod:: query() -> auraxium.census.Query

.. autoclass:: Cached

.. automethod:: alter_cache(size: int, ttu: float | None = None) -> None

.. automethod:: get_by_id(id_: int, *, client: auraxium.Client) -> Cached | None

.. autoclass:: Named

.. automethod:: get_by_name(name: str, *, locale: str = 'en', client: auraxium.Client) -> Named | None

Proxy Objects
=============

Expand Down
2 changes: 1 addition & 1 deletion docs/usage/advanced/caching.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Additionally, cache items have a maximum lifetime to force updates for regularly

Restoring items from cache is currently only supported when using :meth:`Client.get_by_id <auraxium.Client.get_by_id>`.

For :class:`Named <auraxium.base.Named.get_by_name>` subclasses, the :meth:`Client.get_by_name <auraxium.Client.get_by_name>` method is similarly cached by locale. This means that looking up the same name in two different locales will create two separate cache entries.
For :class:`Named <auraxium.base.Named>` subclasses, the :meth:`Client.get_by_name <auraxium.Client.get_by_name>` method is similarly cached by locale. This means that looking up the same name in two different locales will create two separate cache entries.

Customizing Caches
------------------
Expand Down

0 comments on commit 1778421

Please sign in to comment.