feat: add refresh_user_cache method and integrate cache refresh in auth flows
Add a new `refresh_user_cache` method to `DataAccessLayer` that re-caches user objects by both ID and username with the configured TTL. Update `basic_auth` and `webdav_auth` handlers to call this method after successful authentication, ensuring the enterprise cache stays synchronized with user lookups from the fallback ORM path.
This commit is contained in:
@@ -148,6 +148,10 @@ class DataAccessLayer:
|
||||
await self._cache.delete(self._user_by_name_key(username))
|
||||
await self._cache.invalidate_prefix(f"u:{user_id}:")
|
||||
|
||||
async def refresh_user_cache(self, user):
|
||||
await self._cache.set(self._user_key(user.id), user, ttl=self.TTL_USER)
|
||||
await self._cache.set(self._user_by_name_key(user.username), user, ttl=self.TTL_USER)
|
||||
|
||||
async def get_folder(
|
||||
self,
|
||||
user_id: int,
|
||||
|
||||
Reference in New Issue
Block a user