Skip to content

u-masao/object-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

object_cache

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages