Metadata-Version: 2.4
Name: autocacher
Version: 0.1
Summary: Experimental zero-decorator automatic in-memory caching for Python functions.
Author: Vibhakar S
License-Expression: MIT
Project-URL: Homepage, https://github.com/vibhakar2007/autocacher
Project-URL: Repository, https://github.com/vibhakar2007/autocacher
Project-URL: Issues, https://github.com/vibhakar2007/autocacher/issues
Keywords: python,cache,caching,memoization,automatic-cache,performance
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# AutoCache

AutoCache is an experimental Python package that automatically adds in-memory
caching to public synchronous functions in the current Python script.

Instead of manually adding a cache decorator to every function, define your
functions and call `enable()` once.

> AutoCache v0.1 is an experimental alpha release. It is intended for
> testing, learning and feedback rather than production applications.

## Installation

```bash
pip install autocache
```

## Basic usage

```python
import autocache

def expensive_calculation(number):
    print("Calculating...")
    return number ** 2

# Call enable only after defining the functions.
autocache.enable()

print(expensive_calculation(10))  # Cache miss
print(expensive_calculation(10))  # Cache hit
```

## How it works

AutoCache scans public synchronous functions defined in the current
`__main__` module and replaces them with cached wrappers.

Function arguments are serialized and hashed to generate cache keys. Results
are stored in memory for the lifetime of the Python process.

## Current limitations

AutoCache v0.1:

- Uses an in-memory cache
- Scans only functions available when `enable()` is called
- Does not cache asynchronous functions
- Does not cache generator functions
- Does not persist results between program executions
- Has no expiration or maximum cache size
- Should not be used with functions that perform side effects
- Should not be used for database writes, file writes, payments or messages

## Important warning

Only cache functions whose output depends completely on their arguments.

Do not automatically cache functions that:

- Modify files or databases
- Send emails or messages
- Generate random values
- Read frequently changing external data
- Depend on time, global variables or environment state

## Version

Current version: `0.1`

## License

AutoCache is released under the MIT License.
