@@ -130,11 +130,11 @@ Most resources can be requested by using either the `name` or `id` of the resour
130130### Cache
131131If you use the API to get the same resources often,
132132you can enable cache to avoid making unnecessary requests to the PokéAPI server.
133- You can either enable ` in-memory ` or ` in-disk ` cache.
134- Cache is kept per get method.
133+ You can either enable ` memory-based ` or ` disk-based ` cache.
135134
136- #### In-memory
137- ` in-memory ` cache saves resources in RAM. Cache is kept per get method:
135+ #### Memory-based
136+ Memory-based cache is activated by passing ` in_memory ` to the ` cache ` parameter of ` V2Client ` .
137+ Resources obtained from the PokéAPI are then saved in RAM. Cache is kept per get method:
138138``` python
139139>> > client_mem_cache = pokepy.V2Client(cache = ' in_memory' )
140140```
@@ -170,21 +170,24 @@ To clear the cache of a specific get method:
170170CacheInfo(hits = 0 , misses = 0 , size = 0 )
171171```
172172
173- #### In-disk
174- ` in-disk ` cache saves resources to the disk. Cache is kept per get method:
173+ #### Disk-based
174+ Disk-based cache is activated by passing ` in_disk ` to the ` cache ` parameter of ` V2Client ` .
175+ Resources obtained from the PokéAPI are then saved to disk. Cache is kept per get method:
175176``` python
176177>> > client_disk_cache = pokepy.V2Client(cache = ' in_disk' , cache_location = ' /temp' )
177178```
178179
179- For disk-based cache it's possible to specify the cache directory with ` cache_location ` .
180+ In this case it's possible to specify the cache directory with the ` cache_location ` parameter.
181+ A folder named ` pokepy_cache ` will be created inside the specified directory, where the
182+ cache of each get method will be located.
180183If no cache directory is specified a system-appropriate cache directory is automatically determined by
181184[ appdirs] ( https://pypi.org/project/appdirs/ ) .
182185
183- The same methods are used as with ` in-memory ` to check the state and clear the cache.
186+ The methods used to check the state and clear the cache are the same as in the memory-based cache.
184187You can also check the cache directory:
185188``` python
186189>> > client_disk_cache.get_pokemon.cache_location()
187- / temp
190+ / temp/ pokepy_cache / 39 / cache
188191```
189192
190193Disk-based cache is reloaded automatically between runs if the same cache directory is specified.
0 commit comments