diff --git a/docs/requirements.txt b/docs/requirements.txt index 6d5ca528..fce70d7f 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -2,5 +2,4 @@ sphinx furo sphinxcontrib_trio aiohttp -aiocache diff --git a/mipac/actions/user.py b/mipac/actions/user.py index 2dfcf1b2..e58c9a4d 100644 --- a/mipac/actions/user.py +++ b/mipac/actions/user.py @@ -2,15 +2,13 @@ from typing import TYPE_CHECKING, Optional -from aiocache import Cache, cached from mipac.exception import NotExistRequiredData, ParameterError from mipac.http import HTTPClient, Route from mipac.manager.note import NoteManager from mipac.util import ( + cache, check_multi_arg, - get_cache_key, - key_builder, remove_dict_empty, ) @@ -42,7 +40,7 @@ async def get_me(self) -> UserDetailed: res = await self.__session.request(Route('POST', '/api/i'), auth=True) return UserDetailed(res, client=self.__client) # TODO: 自分用のクラスに変更する - @cached(ttl=10, namespace='get_user', key_builder=key_builder) + @cache(group='get_user') async def get( self, user_id: Optional[str] = None, @@ -76,13 +74,12 @@ async def get( ) return UserDetailed(data, client=self.__client) - @get_cache_key + @cache async def fetch( self, user_id: Optional[str] = None, username: Optional[str] = None, host: Optional[str] = None, - **kwargs, ) -> UserDetailed: """ サーバーにアクセスし、ユーザーのプロフィールを取得します。基本的には get_userをお使いください。 @@ -110,8 +107,6 @@ async def fetch( data = await self.__session.request( Route('POST', '/api/users/show'), json=field, auth=True, lower=True ) - old_cache = Cache(namespace='get_user') - await old_cache.delete(kwargs['cache_key'].format('get_user')) return UserDetailed(data, client=self.__client) async def get_notes( diff --git a/requirements.txt b/requirements.txt index 796bed02..ee4ba4f3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1 @@ aiohttp -aiocache