diff --git a/nomad/datamodel/base.py b/nomad/datamodel/base.py index 9c76f6ca8b7f75b8dab765a72692c3754deeadf5..d8a81fd7964a0f3c3263194fdba3fcef27097238 100644 --- a/nomad/datamodel/base.py +++ b/nomad/datamodel/base.py @@ -15,6 +15,7 @@ from typing import Iterable, List, Dict, Type, Tuple, Callable, Any import datetime from elasticsearch_dsl import Keyword +from cachetools import cached, TTLCache from nomad import utils, config, infrastructure @@ -56,6 +57,7 @@ class User: self.repo_user_id = repo_user_id @staticmethod + @cached(cache=TTLCache(maxsize=2048, ttl=24 * 3600)) def get(*args, **kwargs) -> 'User': return infrastructure.keycloak.get_user(*args, **kwargs) # type: ignore