Skip to content
Snippets Groups Projects
Commit e88cdbfe authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Cache user objects.

parent 65bfe65c
No related branches found
No related tags found
1 merge request!71V0.7.0
Pipeline #60302 passed
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
from typing import Iterable, List, Dict, Type, Tuple, Callable, Any from typing import Iterable, List, Dict, Type, Tuple, Callable, Any
import datetime import datetime
from elasticsearch_dsl import Keyword from elasticsearch_dsl import Keyword
from cachetools import cached, TTLCache
from nomad import utils, config, infrastructure from nomad import utils, config, infrastructure
...@@ -56,6 +57,7 @@ class User: ...@@ -56,6 +57,7 @@ class User:
self.repo_user_id = repo_user_id self.repo_user_id = repo_user_id
@staticmethod @staticmethod
@cached(cache=TTLCache(maxsize=2048, ttl=24 * 3600))
def get(*args, **kwargs) -> 'User': def get(*args, **kwargs) -> 'User':
return infrastructure.keycloak.get_user(*args, **kwargs) # type: ignore return infrastructure.keycloak.get_user(*args, **kwargs) # type: ignore
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment