pokelance.cache.cache_manager
⚓︎
Base
⚓︎
Base class for all caches.
Attributes: |
|
---|
set_client(client)
⚓︎
Set the client for the cache.
Parameters: |
|
---|
Source code in pokelance/cache/cache_manager.py
set_size(max_size=100)
⚓︎
Set the maximum cache size.
Parameters: |
|
---|
Source code in pokelance/cache/cache_manager.py
BaseCache(max_size=100)
⚓︎
Bases: MutableMapping[_KT, _VT]
Base class for all caches.
Parameters: |
|
---|
Attributes: |
---|
Examples:
>>> import asyncio
>>> from pokelance import PokeLance
>>>
>>> async def main():
... client = PokeLance()
... print(await client.ping())
... await asyncio.sleep(5) # Wait for all the endpoints to load automatically. If not just load them manually.
... # from pokelance.http import Endpoint
... # data = await client.http.request(Endpoint.get_berry_endpoints())
... # client.berry._cache.load_documents(str(client.berry.__class__.__name__).lower(), "berry", data)
... # print(client.berry.cache.berry.endpoints)
... # await client.berry.cache.berry.load_all(client.http)
... print(client.berry.cache.berry)
... await client.berry.cache.berry.save('temp') # Save the cache to a file.
... await client.berry.cache.berry.load('temp') # Load the cache from a file.
... print(client.berry.cache.berry)
... await client.close()
>>>
>>> asyncio.run(main())
Source code in pokelance/cache/cache.py
endpoints: t.Dict[str, Endpoint]
property
⚓︎
load(path='.')
async
⚓︎
Load the cache from a file.
Parameters: |
|
---|
Source code in pokelance/cache/cache.py
load_all()
async
⚓︎
Load all documents/data from api into the cache. (Endpoints must be cached first)
Source code in pokelance/cache/cache.py
load_documents(data)
⚓︎
Load documents into the cache.
Parameters: |
---|
Source code in pokelance/cache/cache.py
save(path='.')
async
⚓︎
Save the cache to a file.
Parameters: |
|
---|
Source code in pokelance/cache/cache.py
wait_until_ready()
async
⚓︎
Wait until the all the endpoints are cached.
Berry
⚓︎
Bases: Base
Cache for berry related endpoints.
Attributes: |
|
---|
set_client(client)
⚓︎
Set the client for the cache.
Parameters: |
|
---|
Source code in pokelance/cache/cache_manager.py
set_size(max_size=100)
⚓︎
Set the maximum cache size.
Parameters: |
|
---|
Source code in pokelance/cache/cache_manager.py
Cache
⚓︎
Cache for all endpoints.
Attributes: |
|
---|
load_documents(category, _type, data)
⚓︎
Loads the endpoint data into the cache.
Parameters: |
---|
Source code in pokelance/cache/cache_manager.py
set_size(max_size=100)
⚓︎
Set the maximum cache size.
Parameters: |
|
---|
Source code in pokelance/cache/cache_manager.py
Contest
⚓︎
Bases: Base
Cache for contest related endpoints.
Attributes: |
|
---|
set_client(client)
⚓︎
Set the client for the cache.
Parameters: |
|
---|
Source code in pokelance/cache/cache_manager.py
set_size(max_size=100)
⚓︎
Set the maximum cache size.
Parameters: |
|
---|
Source code in pokelance/cache/cache_manager.py
Encounter
⚓︎
Bases: Base
Cache for encounter related endpoints.
Attributes: |
|
---|
set_client(client)
⚓︎
Set the client for the cache.
Parameters: |
|
---|
Source code in pokelance/cache/cache_manager.py
set_size(max_size=100)
⚓︎
Set the maximum cache size.
Parameters: |
|
---|
Source code in pokelance/cache/cache_manager.py
Evolution
⚓︎
Bases: Base
Cache for evolution related endpoints.
Attributes: |
|
---|
set_client(client)
⚓︎
Set the client for the cache.
Parameters: |
|
---|
Source code in pokelance/cache/cache_manager.py
set_size(max_size=100)
⚓︎
Set the maximum cache size.
Parameters: |
|
---|
Source code in pokelance/cache/cache_manager.py
Game
⚓︎
Bases: Base
Cache for game related endpoints.
Attributes: |
|
---|
set_client(client)
⚓︎
Set the client for the cache.
Parameters: |
|
---|
Source code in pokelance/cache/cache_manager.py
set_size(max_size=100)
⚓︎
Set the maximum cache size.
Parameters: |
|
---|
Source code in pokelance/cache/cache_manager.py
Item
⚓︎
Bases: Base
Cache for item related endpoints.
Attributes: |
|
---|
set_client(client)
⚓︎
Set the client for the cache.
Parameters: |
|
---|
Source code in pokelance/cache/cache_manager.py
set_size(max_size=100)
⚓︎
Set the maximum cache size.
Parameters: |
|
---|
Source code in pokelance/cache/cache_manager.py
Location
⚓︎
Bases: Base
Cache for location related endpoints.
Attributes: |
|
---|
set_client(client)
⚓︎
Set the client for the cache.
Parameters: |
|
---|
Source code in pokelance/cache/cache_manager.py
set_size(max_size=100)
⚓︎
Set the maximum cache size.
Parameters: |
|
---|
Source code in pokelance/cache/cache_manager.py
Machine
⚓︎
Bases: Base
Cache for machine related endpoints.
Attributes: |
|
---|
set_client(client)
⚓︎
Set the client for the cache.
Parameters: |
|
---|
Source code in pokelance/cache/cache_manager.py
set_size(max_size=100)
⚓︎
Set the maximum cache size.
Parameters: |
|
---|
Source code in pokelance/cache/cache_manager.py
Move
⚓︎
Bases: Base
Cache for move related endpoints.
Attributes: |
|
---|
set_client(client)
⚓︎
Set the client for the cache.
Parameters: |
|
---|
Source code in pokelance/cache/cache_manager.py
set_size(max_size=100)
⚓︎
Set the maximum cache size.
Parameters: |
|
---|
Source code in pokelance/cache/cache_manager.py
Pokemon
⚓︎
Bases: Base
Cache for pokemon related endpoints.
Attributes: |
|
---|
set_client(client)
⚓︎
Set the client for the cache.
Parameters: |
|
---|
Source code in pokelance/cache/cache_manager.py
set_size(max_size=100)
⚓︎
Set the maximum cache size.
Parameters: |
|
---|