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 hashes)
Built Distribution
Close
Hashes for object_cache-0.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe8e18e5f51076238c86355fcef3fece70ea961bf32637e8329564b5351479c1 |
|
MD5 | 797005284b59180c11264b7f41b970e8 |
|
BLAKE2b-256 | 1b05b44fef6cbbadd03dc954a92558fb8077d0b5b899ab1117ef74f3ce4472f2 |