Documentation

search

Search

  • rocket_launch

    Get started

    • Installation
      add
    • Fundamentals
      add
    • First steps
      add
  • code

    Develop

    • Concepts
      add
    • API reference
      remove
      • PAGE ELEMENTS
      • Text elements
        add
      • Data elements
        add
      • Chart elements
        add
      • Input widgets
        add
      • Media elements
      • Layouts and containers
        add
      • Status elements
        add
      • APPLICATION LOGIC
      • Navigation and pages
        add
      • Execution flow
        add
      • Caching and state
        remove
        • SERVER
        • Jt.cache
        • Jt.sessionState
        • Jt.componentsState
        • BROWSER
        • Jt.urlQueryParameters
      • Connections and secrets
      • Custom components
      • TOOLS
      • App testinglink
      • Command line
        add
    • Quick reference
      add
  • web_asset

    Deploy

    • Concepts
      add
  • school

    Knowledge base

    • FAQ
  • Home/
  • Develop/
  • API reference/
  • Caching and state

Caching and state

Optimize performance and add statefulness to your app!

Caching

Jeamlit provides powerful cache primitives for data and global resources. They allow your app to stay performant even when loading data from the web, manipulating large datasets, or performing expensive computations.

Cache data

Function decorator to cache functions that return data (e.g. dataframe transforms, database queries, ML inference).

// share a ML model - init var mlModel = Jt.cache().computeIfAbsent("model", k -> loadMlModel()); // share a DB connection var conn = Jt.cache().computeIfAbsent("connection", k -> connectToDb());

Browser and server state

Jeamlit re-executes your script with each user interaction. Widgets have built-in statefulness between reruns, but Session State lets you do more!

Session State

Save data between reruns and across pages.

if ((Jt.sessionState().contains("ml_model")) { Jt.sessionState().put("ml_model", loadModel()); } var mlModel = Jt.sessionState().get("ml_model"); // one liner alternative var mlModel = Jt.sessionState.computeIfAbsent("ml_model", k -> loadModel());

Query parameters

Read the query parameters that are shown in the browser's URL bar.

List<String> people = Jt.urlQueryParameters().get("people");
Previous: Execution flowNext: Jt.cache
forum

Still have questions?

Go to our discussions forum for helpful information and advice from Jeamlit experts.


HomeContact UsCommunity
© 2025 Jeamlit - Cyril de Catheu