This module caches the result of function.
Project description
description
This module caches the processing result of the function in the storage, and if the cache hits, skips the processing in the function and returns the result. Create “.object_cache” in the current path and cache it.
install
pip install object-cache
code example
import time
from object_cache import object_cache
@object_cache
def factorial(a):
result = 1
for i in range(2, a + 1):
result *= i
return result
for _ in range(5):
start = time.time()
factorial(100000)
print("elapsed time", time.time() - start)
clear cache
rm -fr .object_cache
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
object-cache-0.1.6.tar.gz
(2.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file object-cache-0.1.6.tar.gz.
File metadata
- Download URL: object-cache-0.1.6.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.10 CPython/3.8.3 Linux/4.4.0-151-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc2f2de71e8549d34d36c5a02b46518b3bd6c1e8a686a5efbfb76d8756ec0dd5
|
|
| MD5 |
806d8c239c930ba5ed75e4c7151fc8e6
|
|
| BLAKE2b-256 |
8b78186ebfe987f03b8d213bb824491156181466a509a1dd2b004b4a6f8bad3d
|
File details
Details for the file object_cache-0.1.6-py3-none-any.whl.
File metadata
- Download URL: object_cache-0.1.6-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.10 CPython/3.8.3 Linux/4.4.0-151-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe8e18e5f51076238c86355fcef3fece70ea961bf32637e8329564b5351479c1
|
|
| MD5 |
797005284b59180c11264b7f41b970e8
|
|
| BLAKE2b-256 |
1b05b44fef6cbbadd03dc954a92558fb8077d0b5b899ab1117ef74f3ce4472f2
|