# rememberer
Rememberer is a tool to help your functions remember their previous results.
The advantage of this package compared to other memoization packages is that
it will remember the result of the function even if you kill the program and restart it.
It will also remember the result even if you restart the python interpreter because
it uses a pickle file to store the results.
## Installation
```bash
pip install rememberer
```
## Usage
```python
from rememberer import rem
def add(a, b):
import time
time.sleep(3)
return a + b
rem(add, 1, b=2) # this will take 3 seconds
rem(add, 1, b=2) # this will take ~0 seconds
```
You can use it as a decorator as well:
```python
from rememberer import rem_dec
@rem_dec
def add(a, b):
import time
time.sleep(3)
return a + b
add(1, b=2) # this will take 3 seconds
add(1, b=2) # this will take ~0 seconds
```
If you want to clear the cache, you can use the `forget` method:
```python
from rememberer import forget
forget(add, 1, b=2)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/ChamRun/rememberer",
"name": "rememberer",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.5",
"maintainer_email": "",
"keywords": "pickle,cache",
"author": "ChamRun",
"author_email": "chrm@aut.ac.ir",
"download_url": "https://files.pythonhosted.org/packages/b0/20/d791872b5202f0cc2a330b88a63cbafc490a1fc68273f9d5900fb77d2902/rememberer-0.1.6.tar.gz",
"platform": null,
"description": "# rememberer\nRememberer is a tool to help your functions remember their previous results.\n\n\nThe advantage of this package compared to other memoization packages is that \nit will remember the result of the function even if you kill the program and restart it. \n\nIt will also remember the result even if you restart the python interpreter because\nit uses a pickle file to store the results.\n\n## Installation\n\n```bash\npip install rememberer\n```\n\n## Usage\n\n```python\nfrom rememberer import rem\n\ndef add(a, b):\n import time\n time.sleep(3)\n return a + b\n\nrem(add, 1, b=2) # this will take 3 seconds\nrem(add, 1, b=2) # this will take ~0 seconds\n```\n\nYou can use it as a decorator as well:\n\n```python\nfrom rememberer import rem_dec\n\n@rem_dec\ndef add(a, b):\n import time\n time.sleep(3)\n return a + b\n\nadd(1, b=2) # this will take 3 seconds\nadd(1, b=2) # this will take ~0 seconds\n```\n\n\nIf you want to clear the cache, you can use the `forget` method:\n\n```python\nfrom rememberer import forget\n\nforget(add, 1, b=2)\n\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Rememberer is a tool to help your functions remember their previous results.",
"version": "0.1.6",
"split_keywords": [
"pickle",
"cache"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3583081e721ef8d65ce9d19afc36395ef5812aef801251397175b906f85b0bfd",
"md5": "b93d2facde21b0ec745f197c1092cfaf",
"sha256": "0d77e29be21f5b5bcdc035cb6fb0668125ae243a5efb2fc18cb03f4a833210bb"
},
"downloads": -1,
"filename": "rememberer-0.1.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b93d2facde21b0ec745f197c1092cfaf",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.5",
"size": 4332,
"upload_time": "2023-02-05T13:32:27",
"upload_time_iso_8601": "2023-02-05T13:32:27.782793Z",
"url": "https://files.pythonhosted.org/packages/35/83/081e721ef8d65ce9d19afc36395ef5812aef801251397175b906f85b0bfd/rememberer-0.1.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b020d791872b5202f0cc2a330b88a63cbafc490a1fc68273f9d5900fb77d2902",
"md5": "b97e629bb4e19274d28217e60c6e8d54",
"sha256": "f223acf28c07076dd526368da4f037f7f674ad82915e13fe20657bdf873b514b"
},
"downloads": -1,
"filename": "rememberer-0.1.6.tar.gz",
"has_sig": false,
"md5_digest": "b97e629bb4e19274d28217e60c6e8d54",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.5",
"size": 4052,
"upload_time": "2023-02-05T13:32:30",
"upload_time_iso_8601": "2023-02-05T13:32:30.248614Z",
"url": "https://files.pythonhosted.org/packages/b0/20/d791872b5202f0cc2a330b88a63cbafc490a1fc68273f9d5900fb77d2902/rememberer-0.1.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-02-05 13:32:30",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "ChamRun",
"github_project": "rememberer",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "setuptools",
"specs": [
[
"==",
"45.2.0"
]
]
}
],
"lcname": "rememberer"
}