pokelance.cache.cache
⚓︎
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.
BerryFirmnessCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.BerryFirmness']
A cache for berry firmnesses.
BerryFlavorCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.BerryFlavor']
A cache for berry flavors.
CharacteristicCache(max_size=100)
⚓︎
Bases: SecondaryTypeCache['Route', 'models.Characteristic']
A cache for characteristics.
ContestEffectCache(max_size=100)
⚓︎
Bases: SecondaryTypeCache['Route', 'models.ContestEffect']
A cache for contest effects.
ContestTypeCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.ContestType']
A cache for contest types.
EncounterConditionCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.EncounterCondition']
A cache for encounter conditions.
EncounterConditionValueCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.EncounterConditionValue']
A cache for encounter condition values.
EncounterMethodCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.EncounterMethod']
A cache for encounter methods.
EvolutionChainCache(max_size=100)
⚓︎
Bases: SecondaryTypeCache['Route', 'models.EvolutionChain']
A cache for evolution chains.
EvolutionTriggerCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.EvolutionTrigger']
A cache for evolution triggers.
GamesGenerationCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.Generation']
A cache for games generations.
GamesPokedexCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.Pokedex']
A cache for games pokedexes.
GamesVersionCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.Version']
A cache for games versions.
GamesVersionGroupCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.VersionGroup']
A cache for games version groups.
GrowthRateCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.GrowthRate']
A cache for growth rates.
ItemAttributeCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.ItemAttribute']
A cache for item attributes.
ItemCategoryCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.ItemCategory']
A cache for item categories.
ItemFlingEffectCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.ItemFlingEffect']
A cache for item fling effects.
ItemPocketCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.ItemPocket']
A cache for item pockets.
LocationAreaCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.LocationArea']
A cache for location areas.
MachineCache(max_size=100)
⚓︎
Bases: SecondaryTypeCache['Route', 'models.Machine']
A cache for machines.
MoveAilmentCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.MoveAilment']
A cache for move ailments.
MoveBattleStyleCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.MoveBattleStyle']
A cache for move battle styles.
MoveCategoryCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.MoveCategory']
A cache for move categories.
MoveDamageClassCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.MoveDamageClass']
A cache for move damage classes.
MoveLearnMethodCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.MoveLearnMethod']
A cache for move learn methods.
MoveTargetCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.MoveTarget']
A cache for move targets.
PalParkAreaCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.PalParkArea']
A cache for pal park areas.
PokeathlonStatCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.PokeathlonStat']
A cache for pokeathlon stats.
PokemonColorCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.PokemonColor']
A cache for pokemon colors.
PokemonFormCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.PokemonForm']
A cache for pokemon forms.
PokemonHabitatCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.PokemonHabitats']
A cache for pokemon habitats.
PokemonLocationAreaCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.LocationAreaEncounter']
A cache for pokemon location areas.
PokemonShapeCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.PokemonShape']
A cache for pokemon shapes.
PokemonSpeciesCache(max_size=100)
⚓︎
Bases: BaseCache['Route', 'models.PokemonSpecies']
A cache for pokemon species.
SecondaryTypeCache(max_size=100)
⚓︎
Bases: BaseCache[_KT, _VT]
A cache for secondary types with differing endpoints.
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. Endpoints are different for secondary types.
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.
SuperContestEffectCache(max_size=100)
⚓︎
Bases: SecondaryTypeCache['Route', 'models.SuperContestEffect']
A cache for super contest effects.