# xtremcache
`xtremcache` is 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.
## Installation
`xtremcache` is available on [PyPi](https://pypi.org/project/xtremcache/).
## Tests
Tests are written following `unittest` framework. Some dependencies are needed (`test-requirements.txt`). If you want to run tests, enter the following command at the root level of the package:
```bash
python -m unittest discover -s tests # All tests
python -m unittest discover -s tests/unit # Unit tests
python -m unittest discover -s tests/integration # Integration tests
```
## Usage
### Cache and uncache example
- Create 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:
```python
from xtremcache.cachemanager import CacheManager
cache_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:
```sh
xtremcache config set cache_dir '/tmp/xtremcache' --local
xtremcache config set max_size '20m' --local
xtremcache cache --id 'UUID' '/tmp/dir_to_cache'
xtremcache uncache --id 'UUID' '/tmp/destination_dir'
```
---
### Override cached example
- Create CacheManager with data location and the maximum size in Mo of this cache directory
- Cache a directory with unique id to find it lather
- Override last unique id to a new directory
Python:
```python
from xtremcache.cachemanager import CacheManager
cache_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:
```sh
xtremcache config set cache_dir '/tmp/xtremcache' --local
xtremcache config set max_size '20m' --local
xtremcache cache --id 'UUID' '/tmp/dir_to_cache'
xtremcache cache --force --id 'UUID' '/tmp/new_dir_to_cache'
```
---
### Cache and clean example
- Create CacheManager with data location and the maximum size in Mo of this cache directory
- Cache a directory with unique id to find it lather
- Remove chached file
Python:
```python
from xtremcache.cachemanager import CacheManager
cache_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:
```sh
xtremcache config set cache_dir '/tmp/xtremcache' --local
xtremcache config set max_size '20m' --local
xtremcache cache --id 'UUID' '/tmp/dir_to_cache'
xtremcache remove --id 'UUID'
```
---
### Cache and clean all example
- Create CacheManager with data location and the maximum size in Mo of this cache directory
- Cache a directory with unique id to find it lather
- Remove all chached files
Python:
```python
from xtremcache.cachemanager import CacheManager
cache_manager = CacheManager(
cache_dir='/tmp/xtremcache',
max_size='20m')
cache_manager.cache(
id='UUID',
path='/tmp/dir_to_cache')
cache_manager.remove()
```
Shell:
```sh
xtremcache config set cache_dir '/tmp/xtremcache' --local
xtremcache config set max_size '20m' --local
xtremcache cache --id 'UUID' '/tmp/dir_to_cache'
xtremcache remove
```
Raw data
{
"_id": null,
"home_page": "",
"name": "xtremcache",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "cache caching store storage file files folder folders archive archives rep repertory repertories",
"author": "xtrembuffalo",
"author_email": "tristan.cladet@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/87/b5/92e28ca241c31b6d05d34ddd4527159300e2d1239c714be9fd73297486bf/xtremcache-2.2.1.tar.gz",
"platform": null,
"description": "# xtremcache\r\n\r\n`xtremcache` is a Python package dedicated to handle generic file and directories caching on Windows or Linux.\r\nThe 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.\r\nThe directory where the cached files are located is local.\r\nThe concurrent access (reading and writing) on chached archives is handle by a small data base located in the local data directory.\r\n\r\n## Installation\r\n\r\n`xtremcache` is available on [PyPi](https://pypi.org/project/xtremcache/).\r\n\r\n## Tests\r\n\r\nTests are written following `unittest` framework. Some dependencies are needed (`test-requirements.txt`). If you want to run tests, enter the following command at the root level of the package:\r\n\r\n```bash\r\npython -m unittest discover -s tests # All tests\r\npython -m unittest discover -s tests/unit # Unit tests\r\npython -m unittest discover -s tests/integration # Integration tests\r\n```\r\n\r\n## Usage\r\n\r\n### Cache and uncache example\r\n\r\n- Create CacheManager with optional data location and the maximum size in Mo of this cache directory.\r\n- Cache a directory with unique id to find it lather.\r\n- Uncache with unique id to a specifique directory.\r\n\r\nPython:\r\n\r\n```python\r\nfrom xtremcache.cachemanager import CacheManager\r\n\r\ncache_manager = CacheManager(\r\n cache_dir='/tmp/xtremcache',\r\n max_size=20_000_000)\r\ncache_manager.cache(\r\n id='UUID',\r\n path='/tmp/dir_to_cache')\r\ncache_manager.uncache(\r\n id='UUID',\r\n path='/tmp/destination_dir')\r\n```\r\n\r\nShell:\r\n\r\n```sh\r\nxtremcache config set cache_dir '/tmp/xtremcache' --local\r\nxtremcache config set max_size '20m' --local\r\nxtremcache cache --id 'UUID' '/tmp/dir_to_cache'\r\nxtremcache uncache --id 'UUID' '/tmp/destination_dir'\r\n```\r\n\r\n---\r\n\r\n### Override cached example\r\n\r\n- Create CacheManager with data location and the maximum size in Mo of this cache directory\r\n- Cache a directory with unique id to find it lather\r\n- Override last unique id to a new directory\r\n\r\nPython:\r\n\r\n```python\r\nfrom xtremcache.cachemanager import CacheManager\r\n\r\ncache_manager = CacheManager(\r\n cache_dir='/tmp/xtremcache',\r\n max_size=20_000_000)\r\ncache_manager.cache(\r\n id='UUID',\r\n path='/tmp/dir_to_cache')\r\ncache_manager.cache(\r\n id='UUID',\r\n path='/tmp/new_dir_to_cache',\r\n force=True)\r\n```\r\n\r\nShell:\r\n\r\n```sh\r\nxtremcache config set cache_dir '/tmp/xtremcache' --local\r\nxtremcache config set max_size '20m' --local\r\nxtremcache cache --id 'UUID' '/tmp/dir_to_cache'\r\nxtremcache cache --force --id 'UUID' '/tmp/new_dir_to_cache'\r\n```\r\n\r\n---\r\n\r\n### Cache and clean example\r\n\r\n- Create CacheManager with data location and the maximum size in Mo of this cache directory\r\n- Cache a directory with unique id to find it lather\r\n- Remove chached file\r\n\r\nPython:\r\n\r\n```python\r\nfrom xtremcache.cachemanager import CacheManager\r\n\r\ncache_manager = CacheManager(\r\n cache_dir='/tmp/xtremcache',\r\n max_size='20m')\r\ncache_manager.cache(\r\n id='UUID',\r\n path='/tmp/dir_to_cache')\r\ncache_manager.remove(\r\n id='UUID')\r\n```\r\n\r\nShell:\r\n\r\n```sh\r\nxtremcache config set cache_dir '/tmp/xtremcache' --local\r\nxtremcache config set max_size '20m' --local\r\nxtremcache cache --id 'UUID' '/tmp/dir_to_cache'\r\nxtremcache remove --id 'UUID'\r\n```\r\n\r\n---\r\n\r\n### Cache and clean all example\r\n\r\n- Create CacheManager with data location and the maximum size in Mo of this cache directory\r\n- Cache a directory with unique id to find it lather\r\n- Remove all chached files\r\n\r\nPython:\r\n\r\n```python\r\nfrom xtremcache.cachemanager import CacheManager\r\n\r\ncache_manager = CacheManager(\r\n cache_dir='/tmp/xtremcache',\r\n max_size='20m')\r\ncache_manager.cache(\r\n id='UUID',\r\n path='/tmp/dir_to_cache')\r\ncache_manager.remove()\r\n```\r\n\r\nShell:\r\n\r\n```sh\r\nxtremcache config set cache_dir '/tmp/xtremcache' --local\r\nxtremcache config set max_size '20m' --local\r\nxtremcache cache --id 'UUID' '/tmp/dir_to_cache'\r\nxtremcache remove\r\n```\r\n",
"bugtrack_url": null,
"license": "GPL-3.0",
"summary": "Handle generic file and directories caching",
"version": "2.2.1",
"split_keywords": [
"cache",
"caching",
"store",
"storage",
"file",
"files",
"folder",
"folders",
"archive",
"archives",
"rep",
"repertory",
"repertories"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "97ad90fe23bc181893a9c47b68fc69bb",
"sha256": "3a611d62b9d38b7ba4f55a86c20e3edb07d24a07e91b1776b57258152a88985c"
},
"downloads": -1,
"filename": "xtremcache-2.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "97ad90fe23bc181893a9c47b68fc69bb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 2740255,
"upload_time": "2022-12-20T14:29:23",
"upload_time_iso_8601": "2022-12-20T14:29:23.596752Z",
"url": "https://files.pythonhosted.org/packages/e8/c1/430f17ba9e72c2d875ae67b48e2bec2993d69631ee58ede324c683cd4497/xtremcache-2.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "1a9aa9c4a5b173ce2453c6877c853528",
"sha256": "59528f97838dbe5ed98e66e3f72fd7aaef37f7a916fa5b55a91cbea939fce21f"
},
"downloads": -1,
"filename": "xtremcache-2.2.1.tar.gz",
"has_sig": false,
"md5_digest": "1a9aa9c4a5b173ce2453c6877c853528",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 2730514,
"upload_time": "2022-12-20T14:29:26",
"upload_time_iso_8601": "2022-12-20T14:29:26.589810Z",
"url": "https://files.pythonhosted.org/packages/87/b5/92e28ca241c31b6d05d34ddd4527159300e2d1239c714be9fd73297486bf/xtremcache-2.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-20 14:29:26",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "xtremcache"
}