Package: xtremcache
xtremcachextremcacheis a Python package dedicated to handle generic file and directories caching on Windows or Linux.
The goal of this module is to be able to cache a file or directory with a unique identifier of your choice and later uncache to a specific location.
The directory where the cached files are located is local.
The concurrent access (reading and writing) on chached archives is handle by a small data base located in the local data directory.Installationxtremcacheis available onPyPi.TestsTests are written followingunittestframework. Some dependencies are needed (test-requirements.txt). If you want to run tests, enter the following command at the root level of the package:python-munittestdiscover-stests# All testspython-munittestdiscover-stests/unit# Unit testspython-munittestdiscover-stests/integration# Integration testsUsageCache and uncache exampleCreate CacheManager with optional data location and the maximum size in Mo of this cache directory.Cache a directory with unique id to find it lather.Uncache with unique id to a specifique directory.Python:fromxtremcache.cachemanagerimportCacheManagercache_manager=CacheManager(cache_dir='/tmp/xtremcache',max_size=20_000_000)cache_manager.cache(id='UUID',path='/tmp/dir_to_cache')cache_manager.uncache(id='UUID',path='/tmp/destination_dir')Shell:xtremcacheconfigsetcache_dir'/tmp/xtremcache'--local
xtremcacheconfigsetmax_size'20m'--local
xtremcachecache--id'UUID''/tmp/dir_to_cache'xtremcacheuncache--id'UUID''/tmp/destination_dir'Override cached exampleCreate CacheManager with data location and the maximum size in Mo of this cache directoryCache a directory with unique id to find it latherOverride last unique id to a new directoryPython:fromxtremcache.cachemanagerimportCacheManagercache_manager=CacheManager(cache_dir='/tmp/xtremcache',max_size=20_000_000)cache_manager.cache(id='UUID',path='/tmp/dir_to_cache')cache_manager.cache(id='UUID',path='/tmp/new_dir_to_cache',force=True)Shell:xtremcacheconfigsetcache_dir'/tmp/xtremcache'--local
xtremcacheconfigsetmax_size'20m'--local
xtremcachecache--id'UUID''/tmp/dir_to_cache'xtremcachecache--force--id'UUID''/tmp/new_dir_to_cache'Cache and clean exampleCreate CacheManager with data location and the maximum size in Mo of this cache directoryCache a directory with unique id to find it latherRemove chached filePython:fromxtremcache.cachemanagerimportCacheManagercache_manager=CacheManager(cache_dir='/tmp/xtremcache',max_size='20m')cache_manager.cache(id='UUID',path='/tmp/dir_to_cache')cache_manager.remove(id='UUID')Shell:xtremcacheconfigsetcache_dir'/tmp/xtremcache'--local
xtremcacheconfigsetmax_size'20m'--local
xtremcachecache--id'UUID''/tmp/dir_to_cache'xtremcacheremove--id'UUID'Cache and clean all exampleCreate CacheManager with data location and the maximum size in Mo of this cache directoryCache a directory with unique id to find it latherRemove all chached filesPython:fromxtremcache.cachemanagerimportCacheManagercache_manager=CacheManager(cache_dir='/tmp/xtremcache',max_size='20m')cache_manager.cache(id='UUID',path='/tmp/dir_to_cache')cache_manager.remove()Shell:xtremcacheconfigsetcache_dir'/tmp/xtremcache'--local
xtremcacheconfigsetmax_size'20m'--local
xtremcachecache--id'UUID''/tmp/dir_to_cache'xtremcacheremove