Skip to content

Caching

enka-py has 3 built-in caching systems:

Installation

For the different caching systems, you need to install the appropriate optional dependencies.

pip install enka[redis]
pip install enka[sqlite]

How-To

import enka

cache = enka.cache.SQLiteCache()

async with enka.GenshinClient(cache=cache) as client:
    await client.fetch_showcase(901211014)  # Cached
    await client.fetch_showcase(901211014)  # From cache

Making Your Own Cache System

You can create your own cache system by subclassing enka.BaseCache and implementing all the abstract methods.