Metadata-Version: 2.4
Name: mysiar-disk-cache-data
Version: 0.0.1
Summary: disk_cache_data decorator
Author: Piotr Synowiec <psynowiec@gmail.com>
License: MIT License
        
        Copyright (c) 2026 Piotr Synowiec 
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest>=9.0; extra == "dev"
Requires-Dist: pytest-cov>=7.0; extra == "dev"
Requires-Dist: ruff>=0.14; extra == "dev"
Requires-Dist: mypy>=1.10; extra == "dev"
Requires-Dist: pandas>=2.0; extra == "dev"
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: twine>=6.0; extra == "dev"
Requires-Dist: black>=25.0; extra == "dev"
Dynamic: license-file

# disk_cache_data decorator

Fully configurable decorator with functionnality as Streamlit st.cache_data with local disk storage as backend.

## Installation

```bash
pip install mysiar-disk-cache-data
```

## Usage 

### disk_cache_data

Configuration by environment variables:
- DISK_CACHE_DISABLED=1 - disable caching
- DISK_CACHE_DEBUG=1 - enable debug logging (currently by print statements)
- DISK_CACHE_DIR=/path/to/cache/dir - set custom cache directory (default is `/tmp/disk_cache`)
- DISK_CACHE_NAMESPACE - subfolder for namespacing (default is `disk_cache`)

```python
from mysiar.disk_cache_data import disk_cache_data

@disk_cache_data(ttl="30s")
def load_data(a, b):
    return a + b

# first call is whole function process
result = load_data(1, 2)
# each next call within ttl is cached
result = load_data(1, 2)
```

### disk_cache_cleanup

Function to cleanup expired cache files.

```python
from mysiar.disk_cache_data import disk_cache_cleanup
disk_cache_cleanup()
```
