Cached DecoratorΒΆ
SimplePlugin provides cached
and
mem_cached
function decorators that
cache return value of a function for a specified amount of time in minutes.
Example:
@plugin.cached(30)
def foo(param):
# Do some stuff
return bar
Here the bar
value will be cached for 30 minutes.
The mem_cached
decorator caches data
in memory so the cache lasts as long as Kodi runs,
while cached
caches data to disk.
The caching decorators can be used, for example, to cache data received from a remote web-site or API, thus reducing the number of requests issued from your addon to that site or API.