Skip to content

Caching and Logins

SORA edited this page Nov 27, 2026 · 1 revision

Reads are cached

A Client keeps successful reads in memory for a bit, so ten people checking the same account in a minute is one request, not ten.

Method Kept for
card(), character(), attendance() 1 minute
monument(), profile() 5 minutes
char_banners(), weapon_banners() 10 minutes
enums() 1 hour
  • errors are never cached
  • the same request already in flight is shared instead of sent twice
  • check_in(), logins and account() always go to SKPORT
client = akef.Client(token, cache=False)   # off
client.clear_cache()                       # reset

The cache lives in one Client, so keep the client around to get anything out of it.

login_file

A fresh client spends two requests logging in. With a file it saves the login after the first run and skips that next time.

client = akef.Client(token, login_file="skport_login.json")
fresh client + card()
without login_file ~1.3 s
with it, after the first run ~0.6 s

The file only works for the token that wrote it. Keep it as private as the token.

When the login expires

SKPORT ends logins two ways, a stale signing key (http 401) or a dead login after a long idle (code 10001). The client logs in again and repeats the request either way. If that fails too you get AuthError, the token itself is dead then.

Enka

akef.Enka reuses Enka's answer for as long as Enka's own ttl says, usually a minute. Enka asks API users to respect that. The game tables sit on disk and refresh after patches.

Clone this wiki locally