@@ -521,7 +521,7 @@ def __init__(self, name: str, dir: Path, width: int) -> None:
521521 if self .dir .is_file ():
522522 raise FileExistsError (f"Cannot copy file: '{ self .dir } ': Is a file." )
523523 self .dir .mkdir (exist_ok = True , parents = True )
524- self .cache : CacheManager = CacheManager ( FileType . LOCAL , FileContentType . DATA if CACHE_ENABLE else FileContentType . PATH )
524+ self .cache : dict [ str , File ] = {}
525525 self .timer = scheduler .repeat (
526526 self .clear_cache , delay = CHECK_CACHE , interval = CHECK_CACHE
527527 )
@@ -902,7 +902,7 @@ async def write(self, hash: str, io: io.BytesIO) -> int:
902902 path = self ._file_endpoint (f"{ hash [:2 ]} /{ hash } " )
903903 await self ._mkdir (self ._file_endpoint (f"{ hash [:2 ]} " ))
904904 await self ._execute (self .session .upload_to (io .getbuffer (), path ))
905- self .files [hash ] = File (path , hash , len (io .getbuffer ()))
905+ self .files [hash ] = File (path , hash , len (io .getbuffer ()), FileContentType . URL )
906906 return self .files [hash ].size
907907
908908 async def get_files (self , dir : str ) -> list [str ]:
@@ -1341,27 +1341,10 @@ async def message(self, channel, data: list[Any], callback=None):
13411341 logger .error (traceback .format_exc ())
13421342
13431343
1344- class CacheManager :
1345- def __init__ (self , type : FileType , data : FileContentType ):
1346- self .type = type
1347- self .data = data
1348- self .cache : dict [str , File ] = {}
1349-
1350- def set (self , key : str , value : File ) -> File :
1351- self .cache [key ] = value
1352- return value
1353-
1354- def get_or_default (self , key : str ) -> Optional [File ]:
1355- if key not in self .cache :
1356- return None
1357- return self .cache [key ]
1358-
1359-
13601344token = TokenManager ()
13611345cluster : Optional [Cluster ] = None
13621346last_status : str = "-"
13631347storages = StorageManager ()
1364- cache : CacheManager = CacheManager ()
13651348
13661349
13671350async def init ():
0 commit comments