Memoize with timeout
Project description
# Memoize with Timeout
Function decorator and anciliary tooling to "memoize", or cache return values from a function call. Timeouts are important to ensure that the cache doesn't grow indefinitely, and has the advantage of culling on length since it is less subject to thrashing.
## Getting Started
### Installing
MWT can be installed using pip:
$ pip install mwt
If you want to run the latest version of the code, you can install from git:
$ pip install -U git+git://github.com/...
### Using MWT
At its simplest, simply decorate your method with MWT:
from mwt import mwt
@mwt()
def fibonacci():
a,b = 1,1
for i in range(n-1):
a,b = b,a+b
return a
print(fibonacci(500))
print(fibonacci(500))
## Contributing
Please read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of conduct, and the process for submitting pull requests to us.
## Versioning
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/your/project/tags).
## Authors
* **Alex King** - *Initial work* - [ak15199](https://github.com/ak15199)
See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project.
## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
## Acknowledgments
Based on inspiration from [MEMOIZE DECORATOR WITH TIMEOUT (PYTHON RECIPE)](http://code.activestate.com/recipes/325905-memoize-decorator-with-timeout/)
Function decorator and anciliary tooling to "memoize", or cache return values from a function call. Timeouts are important to ensure that the cache doesn't grow indefinitely, and has the advantage of culling on length since it is less subject to thrashing.
## Getting Started
### Installing
MWT can be installed using pip:
$ pip install mwt
If you want to run the latest version of the code, you can install from git:
$ pip install -U git+git://github.com/...
### Using MWT
At its simplest, simply decorate your method with MWT:
from mwt import mwt
@mwt()
def fibonacci():
a,b = 1,1
for i in range(n-1):
a,b = b,a+b
return a
print(fibonacci(500))
print(fibonacci(500))
## Contributing
Please read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of conduct, and the process for submitting pull requests to us.
## Versioning
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/your/project/tags).
## Authors
* **Alex King** - *Initial work* - [ak15199](https://github.com/ak15199)
See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project.
## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
## Acknowledgments
Based on inspiration from [MEMOIZE DECORATOR WITH TIMEOUT (PYTHON RECIPE)](http://code.activestate.com/recipes/325905-memoize-decorator-with-timeout/)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mwt-0.9.0b1.tar.gz
(3.7 kB
view details)
Built Distribution
File details
Details for the file mwt-0.9.0b1.tar.gz
.
File metadata
- Download URL: mwt-0.9.0b1.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ed1ad873a14523b0d12177e4dd2f141e44a5344a453fafa29ec3b9a59271d18 |
|
MD5 | 2afdf28eb89576a3a7c262ce1426d2fa |
|
BLAKE2b-256 | 9061f090ac689653714b0da294a4cb63553d8109119feafe7ea3e43e14558067 |
File details
Details for the file mwt-0.9.0b1-py2.py3-none-any.whl
.
File metadata
- Download URL: mwt-0.9.0b1-py2.py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf32bfadf7a5e4c8616736727f23c656b820b0fbb757db0b0770140bb5dce5d5 |
|
MD5 | a121929d89f718cf7495f7087f3ae3f5 |
|
BLAKE2b-256 | f838143cf16bb4f89f19aab2b5305ee26a7b6258ed0f1393537ba40e1911a0c5 |